1, edit my.cnf file
Increase the line skip-grant-tables in the mysqld configuration, remove the Password Authentication Database
Restart mysql
2, an input command mysql login to update mysql.user set authentication_string = password ( '123456') where user = 'root';
3, the refresh permission to flush privileges;
4, edit the configuration file to increase password authentication, restart mysql