实时记录MySQL执行过的SQL语句


SQL #mysql #日志2014-12-01 21:17
开启记录MySQL执行过SQL语句的方法很简单:编辑/etc/my.cnf文件,在[mysqld]节下面添加:log=/var/lib/mysql/sql_row.yige.org.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.yige.org.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.yige.org.log 


pid-file=/var/run/mysqld/mysqld.pid 


修改完毕后,记得重启 MySQL

相关文章

粤ICP备11097351号-1