读书频道 > 网站 > 网页设计 > MySQL技术内幕:InnoDB存储引擎(第2版)
3.2.1 错误日志
13-05-24    奋斗的小年轻
收藏    我要投稿   
本书由国内资深MySQL专家亲自执笔,国内外多位数据库专家联袂推荐。作为国内唯一一本关于InnoDB的专著,本书的第1版广受好评,第2版不仅针对最新的MySQL 5.6对相关内容进行了全面的补充,还根据广大读者的反馈意...立即去当当网订购

错误日志文件对MySQL的启动、运行、关闭过程进行了记录。MySQL DBA在遇到问题时应该首先查看该文件以便定位问题。该文件不仅记录了所有的错误信息,也记录一些警告信息或正确的信息。用户可以通过命令SHOW VARIABLES LIKE 'log_error'来定位该文件,如:

mysql> SHOW VARIABLES LIKE 'log_error'\G;

*************************** 1. row ***************************

Variable_name: log_error

       Value: /mysql_data_2/stargazer.log

1 row in set (0.00 sec)

 

mysql> system hostname

stargazer

可以看到错误文件的路径和文件名,在默认情况下错误文件的文件名为服务器的主机名。如上面看到的,该主机名为stargazer,所以错误文件名为startgazer.err。当出现MySQL数据库不能正常启动时,第一个必须查找的文件应该就是错误日志文件,该文件记录了错误信息,能很好地指导用户发现问题。当数据库不能重启时,通过查错误日志文件可以得到如下内容:

[root@nineyou0-43 data]# tail -n 50 nineyou0-43.err

090924 11:31:18  mysqld started

090924 11:31:18  InnoDB: Started; log sequence number 8 2801063331

090924 11:31:19 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist

090924 11:31:19  mysqld ended

这里,错误日志文件提示了找不到权限库mysql,所以启动失败。有时用户可以直接在错误日志文件中得到优化的帮助,因为有些警告(warning)很好地说明了问题所在。而这时可以不需要通过查看数据库状态来得知,例如,下面的错误文件中的信息可能告诉用户需要增大InnoDB存储引擎的redo log:

090924 11:39:44  InnoDB: ERROR: the age of the last checkpoint is 9433712,

InnoDB: which exceeds the log group capacity 9433498.

InnoDB: If you are using big BLOB or TEXT rows, you must set the

InnoDB: combined size of log files at least 10 times bigger than the

InnoDB: largest such row.

090924 11:40:00  InnoDB: ERROR: the age of the last checkpoint is 9433823,

InnoDB: which exceeds the log group capacity 9433498.

InnoDB: If you are using big BLOB or TEXT rows, you must set the

InnoDB: combined size of log files at least 10 times bigger than the

InnoDB: largest such row.

090924 11:40:16  InnoDB: ERROR: the age of the last checkpoint is 9433645,

InnoDB: which exceeds the log group capacity 9433498.

InnoDB: If you are using big BLOB or TEXT rows, you must set the

InnoDB: combined size of log files at least 10 times bigger than the

InnoDB: largest such row.

点击复制链接 与好友分享!回本站首页
分享到: 更多
您对本文章有什么意见或着疑问吗?请到论坛讨论您的关注和建议是我们前行的参考和动力  
上一篇:1.3 功能
下一篇:1.5 小结
相关文章
图文推荐
JavaScript网页动画设
1.9 响应式
1.8 登陆页式
1.7 主题式
排行
热门
文章
下载
读书

关于我们 | 联系我们 | 广告服务 | 投资合作 | 版权申明 | 在线帮助 | 网站地图 | 作品发布 | Vip技术培训
版权所有: 红黑联盟--致力于做最好的IT技术学习网站