Home  >  Article  >  Database  >  How to reset mysql root password on Mac

How to reset mysql root password on Mac

藏色散人
藏色散人forward
2020-03-06 09:03:213820browse

How to reset mysql root password on Mac

My mysql version is MYSQL V5.7.9. For older versions, please use:

UPDATE mysql.user SET Password=PASSWORD('新密码') WHERE User='root';

Mac OS X - Reset MySQL Root Password

Too many passwords to remember? ? Have you forgotten the root password of MySQL for Mac OS? You can reset a new password by following 4 steps:

Recommendation: "mysql tutorial"

1. Stop mysql server.

Usually in 'System Preferences' > MySQL > 'Stop MySQL Server'

2. Open the terminal and enter:

 sudo /usr/local/mysql/bin/mysqld_safe --skip-grant-tables

3. Open In another new terminal, enter:

 sudo /usr/local/mysql/bin/mysql -u root
     UPDATE mysql.user SET authentication_string=PASSWORD('你的新密码') WHERE User='root';
     FLUSH PRIVILEGES;
     exit

4. Restart MySQL.

Okay, this is done

For more programming related content, please pay attention to php Chinese websiteIntroduction to Programming column!

The above is the detailed content of How to reset mysql root password on Mac. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:segmentfault.com. If there is any infringement, please contact admin@php.cn delete