linux下 root 登錄 MySQL 報錯的成績。本站提示廣大學習愛好者:(linux下 root 登錄 MySQL 報錯的成績)文章只能為提供參考,不一定能成為您想要的結果。以下是linux下 root 登錄 MySQL 報錯的成績正文
比來在centOS 7上,經由過程yum裝置了mysql,裝置勝利後,應用root登錄,湧現了以下報錯:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
mysql版本為:Ver 14.14 Distrib 5.7.10, for Linux(X86_64) using EditLine wrapper
但是現實上並沒有停止過root暗碼設置(不曉得是否是裝置進程有被疏忽的處所?)。
對此就各類尋覓謎底,年夜致有上面一些情形:
有說root的隨秘密碼位於/root/.mysql_secret中,然則我基本沒有/root/.mysql_secret文件。有文章表現
> ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using > password: NO) :表現沒有生成root的暫時暗碼 > > ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using > password: YES) :表現生成了root的暫時暗碼。
有些材料說root的默許暗碼為空,經由確認那是之前的老版本,Mysql 5.6及今後版本出處於平安斟酌,root暗碼曾經不為空了。
終究找到對我來講有效的處理計劃。
發生緣由:
Now that the password MySQL had generated is expired, the problem is reduced to getting this password to work again (1) or generate a new one (2). This can be accomplished by running MySQL with the skip-grant-tables option which would make it ignore the access rights:
處理辦法:
Stop your MySQL server.
Add skip-grant-tables at the end of the [mysqld] section of my.cnf file and save it.
Start MySQL server.
In terminal, typemysql -u root -pto get into MySQL command prompt.
In the command prompt, typeUSE mysql;to get into the mysql database where it keeps database users.
Type
UPDATE user SET password_expired = 'N' WHERE User = 'root';
to let MySQL know the password is not expired (1) or
UPDATE user SET authentication_string = PASSWORD('YourNewPassword'), password_expired = 'N' WHERE User = 'root';
附上鏈接:Unable to access MySQL after it automatically generated a temporary password
宣布出來,供年夜家參考。