Home  >  Article  >  Database  >  How to solve the problem of forgetting to change the password when installing mysql on mac?

How to solve the problem of forgetting to change the password when installing mysql on mac?

零下一度
零下一度Original
2017-06-30 15:24:231147browse


Personal test method 3, the password has been reset successfully.
(Thank you @ very, for telling me that there is a reset method on the official website, and I searched a lot online...
In addition, step1 and 2 come from
English is not good, I don’t understand the official one# #)
step1:
Apple->System Preferences->Click mysql at the bottom and close the mysql service in the pop-up page (click stop mysql server)
step2:
Enter the terminal and enter: cd /usr/local/mysql/bin/
Press Enter and log in with administrator privileges sudo su
Press Enter and enter the following command to disable the mysql verification function./mysqld_safe --skip-grant-tables &
Return After restarting, mysql will automatically restart (the status of mysql in the preferences will change to running)
 

step3.
Enter the command./mysql
After pressing Enter, enter the command FLUSH PRIVILEGES;
After pressing Enter, enter the command SET PASSWORD FOR 'root'@'localhost' = PASSWORD('your new password');
  

At this point, the password change is completed. You can log in successfully.

The above is the detailed content of How to solve the problem of forgetting to change the password when installing mysql on mac?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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