Original link: http://blog.csdn.net/xiaoxu0123/article/details/6258538
1. Set the directory to be stored:
[Email protected] etc]# MORE/ETC/MY.CNF
[Mysqld]
# # #此处省略N个字
Log-error=/var/log/mysql/mysql_error.log #错误日志
Log=/var/log/mysql/mysql.log # # #最好注释掉, generates a lot of logs, including changes to each SQL and environment variables that are executed, etc.
Log-bin=/var/log/mysql/mysql_bin.log # for backup recovery, or master-slave replication. View and clear method, see another text of this blog Binlog
Log-slow-queries=/var/log/mysql/mysql_slow.log #慢查询日志
[Mysqld_safe]
Log-error=/var/log/mysql/mysqld.log
Pid-file=/var/run/mysqld/mysqld.pid
2, need to restart MySQL after configuration
[Email protected] etc]#/etc/init.d/mysqld restart
3. View log:
General Log View:
[[email protected] mysql]# ls
mysql_bin.000001 mysql_bin.index mysqld.log mysql_error.log mysql.log mysql_slow.log
Use cat or more *.log to view normal logs
"Go" [MySQL] Linux MySQL log special