MySQL啟動報錯解決案例

來源:互聯網
上載者:User

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 後,啟動成功。

本文永久更新連結地址:

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.