MySQL启动报错解决案例

新安装的一台CentOS服务器,安装完LAMP后,重启了一下系统,发现MySQL启动不了并报如下的错误:

/etc/init.d/mysqld startStarting MySQL... ERROR! The server quit without updating PID file (/var/lib/mysql/feixiag.pid).
 
查看日志如下:InnoDB: Apply batch completed
2015-03-18 17:28:05 24592 [Note] InnoDB: 128 rollback segment(s) are active.
2015-03-18 17:28:05 24592 [Note] InnoDB: Waiting for purge to start
2015-03-18 17:28:05 24592 [Note] InnoDB: 5.6.21 started; log sequence number 1600607
2015-03-18 17:28:05 24592 [Note] Server hostname (bind-address): '*'; port: 3306
2015-03-18 17:28:05 24592 [Note] IPv6 is available.
2015-03-18 17:28:05 24592 [Note]  - '::' resolves to '::';
2015-03-18 17:28:05 24592 [Note] Server socket created on IP: '::'.
2015-03-18 17:28:05 24592 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist
150318 17:28:05 mysqld_safe mysqld from pid file /var/lib/mysql/feixiag.pid ended
 
google,百度后,也没有找到好的方法,突然想起,我在初始化数据库的时候指定了datadir的路径为/data/mysql,而在/etc/my.conf中的datadir没有修改指定的路径。

查看/etc/my.conf,果然是没有更改,改为datadir=/data/mysql 后,启动成功。

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/dfa665af823849d39bd4281a6232f6c1.html