MySQL服務無法啓動伴隨部分ERROR解決001

MySQL Server 5.7,確認環境配置無誤的情況下

在cmd窗口中進入MySQL下的bin目錄

cd: C:\Program Files\MySQL\MySQL Server 5.7\bin

net start mysql

MySQL 服務正在啓動 .

MySQL 服務無法啓動。

 

服務沒有報告任何錯誤。

 

請鍵入 NET HELPMSG 3534 以獲得更多的幫助。

運行mysqld --console進行檢查,列出ERROR和Warnings如下:

[Warning]Failed to set up SSL because of the following SSL library error: SSL context is not usable without certificate and private key

[Warning]Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.

[ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.

[ERROR] Aborting

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

一個方案如下:

(嘗試過網上的修改my.ini配置的方法,無果,在刪除目錄下my.ini文件後進行了以下操作,而後又神奇的成功了哈哈)

A、進入安裝文件夾MySQL Server 5.7下找到data文件夾,將其刪除之後

新建一個data文件夾

 
 
 
 


B、在上面的cmd命令窗口中輸入:mysqld --initialize-insecure,等待數秒鐘,返回並進入安裝目錄下的data

注意:以上命令只需執行一次,否則會出現以下錯誤(屆時再返回A操作)

C、刷新,在cmd中輸入mysqld install註冊服務

D、啓動服務net start mysql 服務啓動成功

E、用戶登入,到這裏的時候就又出現錯誤碼1045(28000)

回看以上的幾步操作,再返回data目錄下,查看其中的err文件(我用的是EditPlus

mysqld install之後默認初始化host字段爲localhost,user字段爲空的用戶(匿名用戶,密碼也爲空),但僅對information_schema和test數據庫有權限

如文件中“an empty password”

 
 

 

 

 

 

 

 

 

 

F、返回cmd窗口,重新登陸mysql –u root –p

而後在Enter password:的時候,直接回車,好了,登陸成功!

G、現在已經登陸了,就可以使用sql語句修改密碼了

選中數據庫mysqluse mysql;

1)、使用set命令修改:set password for root@localhost = password('新密碼');

2)、UPDATE修改user密碼

use mysql;

update user set password=password("新密碼") where user="root";

flush privileges;刷新權限

修改成功,完事兒!

次日再次啓動,無誤,修改完成

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章