这里是普通文章模块栏目内容页
Mysql服务器无法启动

一、Mysql服务器无法启动,错误日志中提示:

^G/usr/local/mysql/bin/mysqld: File './mysql-bin.000013' not found (Errcode: 13)

120415  8:59:10 [ERROR] Failed to open log (file './mysql-bin.000013', errno 13)

120415  8:59:10 [ERROR] Could not open log file

120415  8:59:10 [ERROR] Can't init tc log

120415  8:59:10 [ERROR] Aborting

==============================

一查看是mysql-bin.000013文件的权限变为了:

-rw-rw---- 1 root root       126 Apr 15 00:10 mysql-bin.000013

原因是我上次使用了"/usr/local/mysql/bin/mysqld_safe --user=root &"启动mysqld,所以产生的binlog文件权限变为root。

提醒一下启动mysql最好不要使用root用户,官方文档提倡用非root用户启动;

---------------------------------------

二、Mysql服务器无法启动,错误日志中提示:

120418 15:40:49 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist

原因是默认安装的data在/usr/local/mysql/data,我操作了: mv /usr/local/mysql/data /home/mysql,看了下/home/mysql/data/mysql目录是空的,说明初始化数据库时的库不在了,所以服务启动不了了,现在只需要重新指定data目录,初始化即可:

/usr/local/mysql/scripts/mysql_install_db --user=mysql --datadir=/home/mysql/data