How to modify the MySQL administrator password
1. Turn off mysql first
Service mysqld stop
2. Manual start
Two methods
A: service mysqld start -- skip-grant-tables -- skip-name-resolve start
B: edit/etc/init. d/mysqld file. Add the -- skip-grant-tables -- skip-name-resolve statement to the line, but remove the added content after the modification.
3. Run mysql
Run the command line to directly enter mysql
4. Change the password
Use mysql;
Here only this method is allowed to change the password update user set password = password ('000000') where user = 'root ';
123456789 is the password I set.
5. Disable mysql
Service mysql stop
6. Restart mysql
Note that you can directly Restart Method A in step 2. If Method B is used, you must delete the added content and restart it.
Service mysqld start
This article permanently updates the link address: