查看: 148|回復: 0

[Solved] best way to reset MYSQL root password on Ubuntu

[複製鏈接]
發表於 2/2/2019 18:15:18 | 顯示全部樓層 |閱讀模式
本帖最後由 Iron_MAN 於 2/2/2019 18:39 編輯

I cannot guarantee it works for all, but it at least perfectly works for me !

1. Use tool (I used WinSCP) to open
/etc/mysql/mysql.conf.d/mysqld.cnf

2. Add skip-grant-tables under
[mysqld]
...
kip-external-locking
skip.png

3. Restart MySQL service by entering sudo service mysql restart on your terminal (I used PuTTY)
restart.png

4. Enter mysql on PuTTY to enter MYSQL
mysql.png

5. Enter use mysql (switch to mysql database)

use mysql

use mysql


6. Change root password to '123456', enter
UPDATE mysql.user SET authentication_string=password('123456') WHERE User='root' AND Host ='localhost';
reset.png

7. Update plugin
UPDATE user SET plugin="mysql_native_password";
plugin.png

8. Flush privileges
flush privilege
flush.png

9. Remove or remark skip-grant-tables from /etc/mysql/mysql.conf.d/mysqld.cnf
resume.png

10. Restart MYSQL service again to take effect
restartagain.png

11. Now you will be able to access MYSQL or phpMyAdmin with root and the new password '123456'

phpMyAdmin

phpMyAdmin

---------------------
Author:DesmondChow@oncity
May this helps, no copyright at all lol


回復

使用道具 舉報

您需要登錄後才可以回帖 登入 | 5秒登記

本版積分規則

Map|區區資訊|#赤柱號|聯絡我們|OnCiTy   城市香港

GMT+8, 19/6/2019 15:40 , Processed in 0.018153 second(s), 9 queries , File On.

OnCiTy, 簡單的近...

© 2017-2018 Designed by 鄉下里香港

快速回覆 回到頂部 返回列表