Home > Database > Mysql Tutorial > How to reset mysql root password on Mac

How to reset mysql root password on Mac

藏色散人
Release: 2020-03-06 15:09:50
forward
3866 people have browsed it

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';
Copy after login

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
Copy after login

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
Copy after login

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!

Related labels:
source:segmentfault.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template