Mac system MySQL root password forgot to retrieve

1. Apple -> System Preferences -> Click mysql at the bottom to close the mysql service in the pop-up page

2. Enter the terminal

enter:
cd /usr/local/mysql/bin/
Log in with administrator privileges
sudo su
Enter the following command after pressing Enter to disable the mysql authentication function
 ./mysqld_safe --skip-grant-tables &
MySQL will restart after
3../mysqladmin -u root -p password 123 to change the password
 
Pro test, database recovery
 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327079023&siteId=291194637