最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

linux下 root 登錄 MySQL 報錯的問題

 更新時間:2016年02月13日 13:13:57   投稿:hebedich  
本文給大家記錄的是個人在linux下使用root用戶登錄mysql的時候遇到的一個錯誤的解決方法,非常的簡單實用,有需要的小伙伴可以參考下。

最近在centOS 7上,通過yum安裝了mysql,安裝成功后,使用root登錄,出現(xiàn)了如下報錯:

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密碼設(shè)置(不知道是不是安裝過程有被忽略的地方?)。

對此就各種尋找答案,大致有下面一些情況:

有說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的默認密碼為空,經(jīng)過確認那是以前的老版本,Mysql 5.6及以后版本出處于安全考慮,root密碼已經(jīng)不為空了。
最終找到對我來說有用的解決方案。

產(chǎn)生原因:

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:

解決方法:

復(fù)制代碼 代碼如下:

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

發(fā)布出來,供大家參考。

相關(guān)文章

最新評論

安宁市| 苗栗市| 武平县| 上饶市| 鸡东县| 博湖县| 建瓯市| 葵青区| 宜兰市| 涿州市| 新竹县| 囊谦县| 会昌县| 彭山县| 阜平县| 得荣县| 侯马市| 湖南省| 沁源县| 兴义市| 习水县| 堆龙德庆县| 弥勒县| 朝阳区| 嘉荫县| 黄浦区| 云梦县| 资溪县| 建平县| 庐江县| 达孜县| 高平市| 涞源县| 神池县| 阿尔山市| 阿合奇县| 汤原县| 武汉市| 克拉玛依市| 新乡市| 大城县|