Mysql報錯Fatal error:Can't open and lock privilege tables

Michael_DD發表於2014-10-17
 Mysql報錯Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist


安裝mysql後,啟動時候沒有啟動成功,檢視了下日誌報錯如下:---------------------------------------------

1   可以:初始化mysql:mysql_install_db

2   目錄許可權問題chown -R mysql:mysql  /var/lib/mysql

[root@localhost local]# less /var/log/mysqld.log
1、檢視報錯資訊如下:
[ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist

2、經過查閱資料得知。要敲如下命令解決:
mysql_install_db –usrer=mysql datadir=/var/lib/mysql
datadir是我的mysql存放檔案目錄

3、然後重啟mysql還是不行:
MySQL Daemon failed to start.
正在啟動 mysqld:                                          [失敗]

4、然後試了下單獨的命令,啟動完成
mysql_install_db

5、啟動mysql服務
[root@mysql mysqld]# /etc/init.d/mysqld restart
停止 mysqld:                                              [確定]
正在啟動 mysqld:                                         [確定]


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29500582/viewspace-1301666/,如需轉載,請註明出處,否則將追究法律責任。

相關文章