Home>Article>Database> Teach you how to quickly reset mysql root password on Mac

Teach you how to quickly reset mysql root password on Mac

藏色散人
藏色散人 forward
2021-10-29 15:12:44 2138browse

Teach you how to quickly reset mysql root password on Mac

Reset the root password of mysql under 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 on Mac OS? You can reset the new password by following 4 steps:

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 another new terminal and 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 complete

Recommended learning: "mysql video tutorial"

The above is the detailed content of Teach you how to quickly 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