開啟方法很簡單:編輯/etc/my.cnf文件,在[mysqld]節下面添加:log=/var/lib/mysql/sql_row.log行(日志的路徑自己根據需要定義)。
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1
log=/var/lib/mysql/sql_row.log
# Disabling symbolic-links is recommended to prevent assorted security risks;
# to do so, uncomment this line:
# symbolic-links=0
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
修改完畢後,記得重啟 MySQL:
service mysql restart
# 或者
/etc/init.d/mysqld stop
/etc/init.d/mysqld start
現在你去 /var/lib/mysql/ 路徑下的 sql_row.log 文件應該是能夠看到 MySQL 什麼時候執行了哪些程序了。