mysql:错误日志log_error:

1、启动错误日志:
在不同的情况下,错误日志会记录在不同的位置,如果没有配置文件指定文件名,则默认为hostname.err
在mysql5.6的RPM发布的方式中,错误日志被放在/var/log/mysqld.log
可以通过my.cnf文件进行配置
[mysqld_safe]
log-error=/var/log/mysqld.log
2、查看错误日志:
mysql错误日志以文本形式存放的

[root@localhost run]# echo > /var/log/mysqld.log 清空mysqld日志文件
[root@localhost run]# cat /var/log/mysqld.log

[root@localhost run]#service myql stop --停止mysql服务
[root@localhost run]# mysqld_safe --skip-grant-tables & 跳过授权进入mysql
[1] 3221
[root@localhost run]# 160328 09:39:08 mysqld_safe Logging to '/var/log/mysqld.log'.
160328 09:39:08 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
160328 09:39:09 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended

[1]+ Done mysqld_safe --skip-grant-tables
[root@localhost run]#
3、查看错误日志:
[root@localhost run]# tail /var/log/mysqld.log
2016-03-28 09:39:09 3398 [ERROR] /usr/local/mysql/bin/mysqld: Can't create/write to file '/var/run/mysqld/mysqld.pid' (Errcode: 2 - No such file or directory)
2016-03-28 09:39:09 3398 [ERROR] Can't start server: can't create PID file: No such file or directory
160328 09:39:09 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
[root@localhost run]# perror 2 --查看错误代码
OS error code 2: No such file or directory/

3、删除错误日志:
错误日志可能会不断的增长,因为有必要的周期性的维护:
推荐的删除方法:
#echo > /var/log/mysqld.log

上一篇:Android SDK ADT下载地址


下一篇:一个php开发的用于路由器的小功能