1. Forget the MySQL password, the solution found from the Internet is recorded here.
Edit the MySQL configuration file/etc/mysql/my.cnf and add a line "Skip-grant-tables" to the [Mysqld] section.
2. Restart the server: sudo service mysql restart
He will have this situation:
MySQL stop/waiting
MySQL start/running, process 18669
3. Enter the MySQL admin command line with a blank password and switch to the MySQL library. Input: MySQL
4. Then enter:
mysql> use MySQL
Database changed
5. Execute Update user set Password=password ("New_pass") where user= ' root '; Reset the password to New_pass. Exit database Management
mysql> Update user Set Password=password ("New_pass") where user= ' root ';
Query OK, 0 rows Affected (0.00 sec)
Rows Matched:4 changed:0 warnings:0
Mysql>quit
6. Go back to vim/etc/mysql/my.cnf and comment or delete the line "Skip-grant-tables" that you just joined.
Restart the MySQL service again with the sudo services MySQL restart, login with the new password, and modify the success.
Forgot MySQL root password solution under Ubuntu