Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am running MySQL 5.0.45 on OS X 10.6.1 and I cannot get MySQL to log anything. I am debugging an application and need to see all queries and errors.

I added to the etc/my.cnf:

bind-address =
log = /var/log/mysqld.log
log-error = /var/log/mysqld.error.log

I used sudo to create two log files, set permissions to 644, then restarted MySQL.

I referred to http://serverfault.com/questions/42531/where-is-my-mysql-log-on-os-x in order to troubleshoot.


ps auxww|grep [m]ysqld


_mysql      71   0.0  0.8   646996  15996   ??  S     7:31PM   0:01.10 /usr/local/mysql/libexec/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/var --pid-file=/usr/local/mysql/var/Macintosh-41.local.pid
_mysql      46   0.0  0.0   600336    744   ??  Ss    7:30PM   0:00.03 /bin/sh /usr/local/mysql/bin/mysqld_safe

And running:

$(ps auxww|sed -n '/sed -n/d;/mysqld /{s/.* \([^ ]*mysqld\) .*/\1/;p;}') --verbose --help|grep '^log'


log                               /var/log/mysqld.log
log-bin                           (No default value)
log-bin-index                     (No default value)
log-bin-trust-function-creators   FALSE
log-bin-trust-routine-creators    FALSE
log-error                         /var/log/mysqld.error.log
log-isam                          myisam.log
log-queries-not-using-indexes     FALSE
log-short-format                  FALSE
log-slave-updates                 FALSE
log-slow-admin-statements         FALSE
log-slow-queries                  (No default value)
log-tc                            tc.log
log-tc-size                       24576
log-update                        (No default value)
log-warnings                      1


mysql> show variables like '%log%';


| Variable_name                   | Value                     |
| back_log                        | 50                        | 
| binlog_cache_size               | 32768                     | 
| expire_logs_days                | 0                         | 
| innodb_flush_log_at_trx_commit  | 1                         | 
| innodb_locks_unsafe_for_binlog  | OFF                       | 
| innodb_log_arch_dir             |                           | 
| innodb_log_archive              | OFF                       | 
| innodb_log_buffer_size          | 1048576                   | 
| innodb_log_file_size            | 5242880                   | 
| innodb_log_files_in_group       | 2                         | 
| innodb_log_group_home_dir       | ./                        | 
| innodb_mirrored_log_groups      | 1                         | 
| log                             | ON                        | 
| log_bin                         | OFF                       | 
| log_bin_trust_function_creators | OFF                       | 
| log_error                       | /var/log/mysqld.error.log | 
| log_queries_not_using_indexes   | OFF                       | 
| log_slave_updates               | OFF                       | 
| log_slow_queries                | OFF                       | 
| log_warnings                    | 1                         | 
| max_binlog_cache_size           | 4294967295                | 
| max_binlog_size                 | 1073741824                | 
| max_relay_log_size              | 0                         | 
| relay_log_purge                 | ON                        | 
| relay_log_space_limit           | 0                         | 
| sync_binlog                     | 0                         | 
26 rows in set (0.00 sec)

Any help on how I can get MySQL to log?

share|improve this question
add comment

3 Answers

Even though you used 'chmod 777', make sure mysql is the owner of the logs.

touch /var/log/mysql.log
chown mysql:mysql /var/log/mysql.log
touch /var/log/mysql.error.log
chown mysql:mysql /var/log/mysql.error.log

Next, restart mysqld.

Then, log into mysql and run:

mysql> show variables like '%log%';

Look at the values for general_log, general_log_file, log, log_error, etc. Switch them on as needed and run mysqladmin flushlogs as needed.

share|improve this answer
Or better yet: set the logfile to a sane mode, like 664 or even 660. For the love of the Gods, do not set logfiles to mode 777! I don't know who advised you to do so, @RyOnLife, but you should kick him gently in the groin for telling you this. –  wzzrd Oct 5 '09 at 11:38
777 was a typo. I meant to write 664. Thanks. –  RyOnLife Oct 5 '09 at 14:16
Now logging. Must have been the ownership oversight. Although, see my edited question for results of "show variables like '%log%'" query. MySQL is logging to /var/log/mysql.log, so why doesn't it show? –  RyOnLife Oct 5 '09 at 14:43
add comment

To enable the log files, you need to make sure that one or more of the following directives are in the [mysqld] section of your mysql server's main configuration file (/etc/my.cnf on mine):


The logs will be created, by default, in the same data directory that holds the database subdirectories themselves (typically /var/lib/mysql) and the log file names default to the hostname followed by a suffix that matches the directive names above (eg. -bin, -slow-queries, etc).

To keep your logs in a different path, or using different filenames, specify the base name following the log= directive, and any path and filename you like e.g.:


You need to restart the restart mysqld for these changes to take effect.

share|improve this answer
add comment
  1. Enter mysql command line with super privileges and perform:
SET GLOBAL general_log_file = '/var/log/mysql/mysql.log'; 

In my case, it didn't matter if I had this var already set with the same value! Also I changed permissions and the owner of the file as said in the other posts.

share|improve this answer
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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