After installing MySQL, the system gives a default password and then says if you forget the default password ... I copied the default password and took one step, which was the beginning of my long journey. His password is too complicated, of course, I have to change, and I will pretend that I do not remember the password, so I walked on the road of no return ...
This process is sad, online information, such as dogs, the key is each have their own wrong method, tried for a long time did not have a right, in the impending break psychological defense, to go over the MySQL document, I changed the success. No article told me the complete answer, I was referring to several raiders, behind closed doors built cars. Give yourself some praise. Don't say much nonsense, step by step with me.
Shutdown MySQL Server
Sudo/usr/local/mysql/support-files/mysql.server stop
You can also have a MySQL shutdown in your system preferences.
Cd/usr/local/mysql/bin Access Directory
sudo su Get Permissions
./mysqld_safe--skip-grant-tables & Restart Server
To open a terminal,
To configure a short command:
Alias Mysql=/usr/local/mysql/bin/mysql
Enter MySQL into MySQL command mode
Use MySQL to enter the MySQL database
Flush privileges is probably to get permission, or he won't let you change.
Set password for ' root ' @ ' localhost ' =password (' new password '); Complete the Modification
I'm finally done.
If you know the password:
mysqladmin-u root-p password New password .....
The above is a small set to introduce the Mac forgot MySQL password after the method of resetting the password, I hope to help you, if you have any questions please give me a message, small series will promptly reply to everyone. Here also thank you very much for the cloud Habitat Community website support!
Ps:mac operating system under the MySQL database password forgotten fast solution
1. In the system preferences, the termination of the MySQL service.
2. Cd/usr/local/mysql-...../bin
sudo./mysqld_safe--skip-grant-tables
3. Login to MySQL;
Mysql
4. The password of the empty root user;
mysql> Update mysql.user set password= ' whereuser= ' root;
mysql> flush Privileges;
Mysql> quit
5. Restart the MySQL service,
6. Add password mysql> mysqladmin-u root-p password 123 password to 123