來源: http://www.zhimengzhe.com/shujuku/other/267631.html 感覺還是挺坑的 自己沒了解清楚 就動手 轉帖一下 mark 一下.
1、首先停止正在運行的MySQL進程
Linux下,運行 killall -TERM MySQLd
Windows下,如果寫成服務的 可以運行:net stopMySQL,如未加載為服務,可直接在進程管理器中進行關閉。
2、以安全模式啟動MySQL
Linux下,運行 /usr/local/mysql/bin/mysqld_safe --skip-grant-tables &
Windows下,在命令行下運行 X:/MySQL/bin/mysqld-nt.exe --skip-grant-tables
3、完成以后就可以不用密碼進入MySQL了
Linux下,運行 /usr/local/mysql/bin/mysql -u root -p 進入
Windows下,運行 X:/MySQL/bin/mysql -u root -p 進入
4、更改MySQL數據庫密碼
>use mysql
>update user set authentication_string=password("new_pass") where user="root";
>flush privileges;
以上就是mysql 5.7.14+ 版本更改密碼, 原來user表的password變成了authentication_string的說明