我在OS X 10.6.1上运行MySQL 5.0.45,但我无法使MySQL记录任何内容。我正在调试应用程序,需要查看所有查询和错误。
我添加到etc / my.cnf:
[mysqld]
bind-address = 127.0.0.1
log = /var/log/mysqld.log
log-error = /var/log/mysqld.error.log
我使用sudo创建了两个日志文件,将权限设置为644,然后重新启动了MySQL。
我提到了OS X上的mysql日志在哪里?为了排除故障。
运行:
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
并运行:
$(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)
关于如何获取MySQL日志的任何帮助?