MacOS重設MySQL密碼

JeffChang
1 min readJul 13, 2018

被MySQL 8.0版搞死,

重新安裝5.7版本時又遇到修改預設密碼的問題,

只好寫下操作記錄以防下次再發生。

  1. > mysql -u root -p
  2. (輸入安裝時預設的密碼)
  3. SET PASSWORD = PASSWORD(‘P@ssw0rd’);
  4. > FLUSH PRIVILEGES;
  5. > quit

PS. 看StackOverflow有提供這個方式,但會出錯,故修正為上面方式。

UPDATE mysql.user SET Password=PASSWORD('your_new_password')
WHERE User='root';

參考文章:

  1. Setting the MySQL root user password on OS X
  2. Reset MySQL root password using ALTER USER statement after install on Mac

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

JeffChang
JeffChang

Written by JeffChang

Java Backend Engineer In DDIM.

No responses yet

Write a response