Linux下mysql數據庫root無法登錄的情況


系統:Ubuntu

我用的是xampp

問題:

Access denied for user 'root'@'localhost' (using password:YES) 

 

注:不確定其他情況是否可以解決。

在網上找了很多資料,試了很多方法,說的都大相徑庭,任然沒有解決我的問題。

然后請教了一位前輩,在結合了自己百度的資料,終於搞定了,

好了不說了,說問題:

1.停止當前mysql服務

/opt/lampp/lampp stop

要是停不了,直接殺死進程(我就是這么干的)

2.運行下這個命令

mysqld --skip-grant-tables

(當我運行到這步的時候就報錯了)

2017-03-31 15:15:24 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2017-03-31 15:15:24 14477 [ERROR] Fatal error: Please read "Security" section of the manual to find out how to run mysqld as root!

2017-03-31 15:15:24 14477 [ERROR] Aborting

2017-03-31 15:15:24 14477 [Note] Binlog end
2017-03-31 15:15:24 14477 [Note] mysqld: Shutdown complete

  好吧!根據提示又這樣 

mysqld --skip-grant-tables --explicit_defaults_for_timestamp

然而並沒有什么卵用,然后前輩給我說用這個

mysqld --skip-grant-tables --user=root

不多說了,看圖

進入安全模式 ,然后再開個遠程鏈接

這個別關, 直接mysql -uroot -p密碼沒有就不填直接回車
 
我反正就是這樣進去了,然后就是修改密碼,這個就不說了
 
mysql>use mysql;
mysql> update user set password=passworD("123456") where user='root';
mysql> flush privileges;
mysql> exit; 

  好了就是這樣,第一次寫不喜勿噴。

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM