[ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist

來源:互聯網
上載者:User

標籤:blog   var   class   系統資料   ice   tmp   tab   資料檔案   .net   

這個問題是由於data的目錄下沒有安裝資料庫表

解決方案:

vi /etc/my.cnf

修改為正確的datadir=“xxxxx”即可

然後service mysqld start

service mysql start

正常啟動後,會再/var/lib/mysql下面產生mysql.sock檔案,

然後還報:ERROR 2002 (HY000): Can‘t connect to local MySQL server through socket ‘/tmp/mysql.sock‘

可以指定mysql.sock路徑:

mysql -u root -p -S /var/lib/mysql/mysql.sock

還有有時候是你的目錄許可權的問題:

記得賦許可權:chown -R mysql:mysql  /usr/local/mysql

 

以上是轉自 http://blog.csdn.net/ec06cumt/article/details/50778240

 

我檢查了data檔案下是沒有資料庫檔案也就是上面所說的“由於data的目錄下沒有安裝資料庫表”

但是我的問題是,伺服器上資料庫被黑掉了,所有資料都被刪掉了(包括mysql內建的資料庫),所以我的解決方案思路:1.複製一份系統資料檔案過去;2.重裝mysql。

於是我把我本地的mysql,performance_schema,test三個檔案夾拷至伺服器的data檔案夾下重啟我的phpstudy(我的是Integration Environment)。OK   問題解決

[ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.