Reputation: 6386
I am using ubuntu and I gave the file im using mysql.log a chmod of 777. I also tried using chown mysql:mysql and here is the segment in my my.cnf file.
general_log_file = /var/www/logs/mysql.log
general_log = 1
I ran a simple query and nothing happen in the file. So I went into mysql via terminal and typed
SET GLOBAL general_log:=1;
and I get
ERROR 29 (HY000): File '/var/www/logs/mysql.log' not found (Errcode: 13)
The file does exist, I don't understand why mysql can't see it. I tried these commands to see if the data was saved into mysql and the information looks correct
SELECT @@global.general_log;
SELECT @@global.general_log_file;
SELECT @@global.log_output;
What chown user do I need to use? I have tried everything and mysql just doesn't want to log queries. I want to log all queries. This is a development server so it's not live.
Upvotes: 5
Views: 4682
Reputation: 939
If you specify no name for the general query log file, the default name is host_name.log. The server creates the file in the data directory unless an absolute path name is given to specify a different directory.
For example in mysq server, the file is: /var/lib/mysql/myServer.log
http://dev.mysql.com/doc/refman/5.7/en/query-log.html
Upvotes: 1
Reputation:
Mine are set in a custom location with the permissions -rw-rw-rw-
and owner and group are set to root
. You should also make sure that whatever user you're giving the permissions to has access to every directory above the one you're trying to give it access to.
Also, I'd recommend that you don't put your logs inside of public_html
. This will allow malicious persons to gain information about your SQL version and such, and even worse, give them a place to see if what they're trying is working.
Upvotes: 1