国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 數據庫 > MySQL > 正文

linux下 root 登錄 MySQL 報錯的問題

2024-07-24 13:08:48
字體:
來源:轉載
供稿:網友
本文給大家記錄的是個人在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

發布出來,供大家參考。



注:相關教程知識閱讀請移步到MYSQL教程頻道。
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 县级市| 广灵县| 大悟县| 韶关市| 遂昌县| 北安市| 延长县| 夏河县| 林甸县| 德阳市| 海城市| 宽甸| 舒城县| 来凤县| 漳平市| 正宁县| 巫溪县| 益阳市| 盘锦市| 平舆县| 商洛市| 丰原市| 石台县| 潼关县| 石景山区| 汤原县| 合阳县| 大方县| 浪卡子县| 伊通| 玛纳斯县| 梅河口市| 静安区| 大连市| 吴旗县| 金湖县| 维西| 城固县| 乌审旗| 阳信县| 荣昌县|