How can I forget the root password for MySQL5.7 on Mac? mysql5.7root

Source: Internet
Author: User

How can I forget the root password for MySQL5.7 on Mac? mysql5.7root

Follow these steps to forget the root password of mysql5.7:

1. Stop the MySQL service in the system preference settings.

2. Run the following command to start MySQL in safe mode:

Cd/usr/local/mysql/bin

Sudo./mysqld_safe -- skip-grant-tables


3. Open a new command line window and execute

Update mysql. user set authentication_string = PASSWORD ('your password') where User = 'root ';

Flush privileges;

Note: On the internet, update mysql. user set password = PASSWORD ('000000') where User = 'root' is generally executed. However, the execution fails, prompting that no password field exists.


4. Close the MySQL database. I will directly kill the process because I cannot close MySQL in the window started in step 1.


5. Start the MySQL service in the system preference settings.

6. Run mysql-u root-p and enter the password to log on to MySQL.

7. After the First Login is installed, the system will prompt that the PASSWORD has expired. You can run the set password for root @ 'localhost' = PASSWORD ('new password') command to change the PASSWORD.


The above is all the content of this article. I hope it will be helpful for your learning and support for helping customers.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.