MySQLHow to solve the problem of forgetting the initial password. This article mainly introduces the solution to the problem of forgetting the initial password of MySQL under MAC. It has certain reference value. Interested friends can refer to it
The method to solve the problem of forgetting the initial password of MySQL under MAC is shared with everyone for your reference. The specific content is as follows
The first step:
Click on the system Preferences-> Click MySQL at the bottom, and in the pop-up page, close the service
##Step 2:Enter the terminal and enter: cd /usr/local/mysql/bin/
Press Enter to log in with administrator rights sudo su
Press Enter and enter the following command to disable the mysql verification function./mysqld_safe --skip-grant- tables &
After pressing Enter, mysql will automatically restart (the status of mysql in the preferences will change to running)
Step 3: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');
The above is the detailed content of Sharing the solution for forgetting the initial password of MySQL under MAC (picture). For more information, please follow other related articles on the PHP Chinese website!