Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

This question already has an answer here:

I want to log all queries to the database running on my MacBook Pro (Mac OS X 10.8.1). I created a file /etc/my.cnf with the following content:

[mysqld]
general_log=1
general_log_file=/Users/wdb/mysql.log

I restarted MySQL and tried some queries on the mysql command line, but nothing gets logged. The file is not getting created. I also created the file myself afterwards to test with touch, but the file remains empty.

When I check, MySQL did read my settings:

mysql> show variables like '%general_log%';
+------------------+----------------------+
| Variable_name    | Value                |
+------------------+----------------------+
| general_log      | ON                   |
| general_log_file | /Users/wdb/mysql.log |
+------------------+----------------------+
2 rows in set (0.01 sec)

Is there anything else I need to do? I suppose any query I type on the command line should get logged, right?

I am using MySQL 5.5.24

share|improve this question

marked as duplicate by RolandoMySQLDBA, Paul White, Max Vernon, Mark Storey-Smith, Mat Apr 22 '13 at 9:55

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

3  
The file is probably not writable by the MySQL user. Check the permissions, plus the permissions of the directory it resides in. –  Phil Feb 20 '13 at 10:17
add comment

1 Answer 1

The problem is indeed as @Phil hinted at. To fix it, set the permissions for the _mysql user:

> cd ~
> touch mysql.log
> sudo chown _mysql:wheel mysql.log

Restart MySQL after that and the log file will be used.

share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.