Home > Database > Mysql Tutorial > body text

How to Reset MySQL Root Password on Mac After Installation?

DDD
Release: 2024-11-16 17:59:03
Original
821 people have browsed it

How to Reset MySQL Root Password on Mac After Installation?

How to Reset MySQL Root Password After Installation on Mac

When installing MySQL on Mac, it's common to encounter a situation where the root password needs to be reset. If the traditional method of updating the 'password' field with 'authentication_string' proves unsuccessful, an alternative approach may be necessary.

For those who have already set the root password once, you can utilize the following command:

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

However, if you encounter an error indicating that you need to reset the password using the 'ALTER USER' statement, you may have never set a root password. To rectify this, use the following command instead:

mysql> SET PASSWORD = PASSWORD('your_new_password');
Copy after login

This command will set the root password for the first time.

Note: For further reference, consult the MySQL documentation: https://dev.mysql.com/doc/refman/5.6/en/alter-user.html

The above is the detailed content of How to Reset MySQL Root Password on Mac After Installation?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
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