mac 上怎麼重置mysql的root的密碼?

時間 2021-05-30 00:14:26

1樓:Xianan Zhang

The best answer I got online

My mysql version is 5.7.16,

For those who hasn't solved the problem:

1. Stop MYSQL Server

2. Open terminal and enter: cd /usr/local/mysql/bin/

3. Enter: sudo su , then enter your mac password

4. Enter: sudo /usr/local/mysql/bin/mysqld_safe --skip-grant-tables

5. Open a new terminal tab and enter: sudo /usr/local/mysql/bin/mysql -u root

6. Enter: UPDATE mysql.

user SET authentication_string=PASSWORD('YOUR NEW MYSQL PASSWORD') WHERE User='root';

7. Enter: FLUSH PRIVILEGES;

8.Enter: \q

Hope this might help you, it took me almost half a day to find the solution, and it works just fine to me.

2樓:Viva Loki

關閉mysql伺服器

sudo /usr/local/mysql/support-files/mysql.server stop

也可以在系統偏好裡有個MySQL裡關閉。

cd /usr/local/mysql/bin 進入目錄

sudo su 獲取許可權

./mysqld_safe --skip-grant-tables & 重啟伺服器

重開個終端,

配置短命令:

alias mysql=/usr/local/mysql/bin/mysql

輸入mysql 進入mysql命令模式

use mysql進入mysql資料庫

flush privileges;大概就是獲取許可權,要不他不讓你改。

set password for 'root'@'localhost'=password('新密碼'); 完成修改

我靠終於改完了。

如果你知道密碼:

mysqladmin -u root -p password 新密碼

3樓:YF Liu

沒設root密碼可以用./mysqladmin命令。要是設了root密碼,就要先用「.

/mysqld_safe --skip-grant-tables &」取消密碼驗證,然後可以無密碼連線資料庫,修改root密碼即可。

Mac電腦上Excel怎麼連線mysql?

步驟有些複雜,要安裝ODBC 並進行一系列設定,然而由於軟體版本的問題,還不一定成功。所以我建議你可以考慮讓懂MySQL的同事把資料匯出為csv,或者Excel格式,幾萬或者幾十萬條資料匯出都很快。然後再用Excel操作。方便很多啊。 周 無名 裝mysql的驅動啊 Download Connect...

mac上python的multiprocessing的qsize的呼叫錯誤?

黃哥 請看Got NotImplementedError on macOS Issue 368 jhfjhfj1 autokeras請看 Got NotImplementedError on macOS Issue 368 jhfjhfj1 autokeras class SharedCounter...

R星會用《荒野大鏢客2》的引擎,重置《荒野大鏢客1》麼?

DFFL 我作為沒有主機的玩家當然是希望出PC版重製版的大表哥1,但是鑑於國外的主機玩家群體是大於PC版玩家的,這樣的話R星賺不了多少錢,再加上即使在今天大表哥1的表現照樣強於2077的,大表哥2的熱度同樣讓大表哥1的銷量回公升了不少,R星的工作人員精力也主要放在GTA5OL和大表哥2OL,以及GT...