久久青草精品A片狠狠,日韩欧美视频一区二区,亚洲国码AV日韩,国产精品黄在

linux下忘記mysql root密碼解決辦法

2017-11-15 14:55:03 13981

編輯MySQL配置文件my.cnf

vi /etc/my.cnf #編輯文件,找到[mysqld],在下面添加一行skip-grant-tables


[mysqld]

skip-grant-tables

:wq! #保存退出

shutdown -r now #重啟系統


進入MySQL控制臺

mysql -uroot -p #直接按回車,這時不需要輸入root密碼。


修改root密碼

update mysql.user set password=password('123456') where User="root" and Host="localhost";

flush privileges; #刷新系統授權表


update mysql.user set password=password('123456') where User="root" and Host="localhost";

flush privileges; #刷新系統授權表


取消/etc/my.cnf中的skip-grant-tables

vi /etc/my.cnf 編輯文件,找到[mysqld],刪除skip-grant-tables這一行

:wq! #保存退出


重啟mysql

service mysqld restart #重啟mysql,這個時候mysql的root密碼已經修改為123456


進入mysql控制臺

mysql -uroot -p #進入mysql控制臺

123456 #輸入密碼


提交成功!非常感謝您的反饋,我們會繼續努力做到更好!

這條文檔是否有幫助解決問題?

非常抱歉未能幫助到您。為了給您提供更好的服務,我們很需要您進一步的反饋信息:

在文檔使用中是否遇到以下問題: