How to reset the password after the password of MySQL is forgotten in Mac OS, macmysql
After MySQL is installed, the system gives a default password and says that if you forget the default password ...... I copied the default password and took only one step. This step is the beginning of my long journey. The password he gave was too complicated. Of course I had to change one, and I had to pretend that I didn't remember the password, so I couldn't go back ......
This process is sad. There are many documents on the Internet, such as dogs. The key is that there are different ways of error. After trying for half a day, there is no such thing, and the psychological defense will be broken soon, when I go to the MySQL document, I have successfully changed it. No article tells me the complete answer. I have referenced several strategies and closed-doors cars. Like yourself. Let's talk a little bit about it. Let's go with me step by step.
Disable mysql Server
Sudo/usr/local/mysql/support-files/mysql. server stop
You can also disable MySQL in the system preference.
Cd/usr/local/mysql/bin to enter the Directory
Sudo su
./Mysqld_safe -- skip-grant-tables & restart the server
Reopen a terminal,
Configure short commands:
Alias mysql =/usr/local/mysql/bin/mysql
Enter mysql to enter mysql command mode
Use mysql to enter the mysql database
Flush privileges; it is probably to get the permission, or he won't let you change it.
Set password for 'root' @ 'localhost' = password ('new password'); Complete Modification
I finally finished the change.
If you know the password:
Mysqladmin-u root-p password new password ...........
The above section describes how to reset the password after I forget the MySQL password in Mac. I hope it will be helpful to you. If you have any questions, please leave a message for me, the editor will reply to you in a timely manner. Thank you very much for your support for the help House website!
PS: a quick solution for forgetting the MYSQL Database Password in Mac OS
1. In system preferences, stop the MYSQL service .;
2. cd/usr/local/mysql-.../bin
Sudo./mysqld_safe -- skip-grant-tables
3. log on to MySQL;
Mysql
4. Leave the password of the root user blank;
Mysql> update mysql. user set password = ''whereUser = 'root ';
Mysql> flush privileges;
Mysql> quit
5. Restart the MySQL service,
6. Change the password mysql> mysqladmin-u root-p password 123 to 123.