MySQL forgets the password and then resets the password (Mac). mysql forgets the password.
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 ...........