記錄下當時自己的操作,希望對你解決問題有幫助:
首先打開Mac 自帶的 terminal:
Go to mysql/bin directory(到該目錄下)
$ cd /usr/bin
Start a mysql deamon with this option:
$ sudo mysqld_safe --skip-grant-tables
Open another terminal and open a mysql session to execute this: (再開啟一個terminal : 快捷鍵 command + t)
$ mysql mysql> use mysql;
see Note1 below for next line.
mysql> UPDATE user SET authentication_string=PASSWORD('YOUR_NEW_PASSWORD_HERE') WHERE user = 'root'; //藍色的就是你要輸入的新密碼
mysql> exit;
Now kill the mysqld_safe process and restart mysqld normally:
$ sudo service mysqld start
就是這么簡單!
Note1: password
is the column name in table mysql.user
prior to version 5.7. After which it became authentication_string
. Change your update statement accordingly.
如果解決了你的問題,打個賞吧
想學習黑客入門,聯系QQ392371202.
另外,我這里有破解版的Navicat.dmg
給自己打個廣告:https://www.cnblogs.com/vector11248/p/11367664.html
關於我:
90后小碼農,畢業於北郵計算機,渣碩,寫過ios,做過信息安全,現在在微軟STCA做Flink流式處理。希望和大家多多交流!
如何你們看不懂,給我留言,我教你。