1、停止mysql服务
2、mysqld --console --skip-grant-tables --shared-memory
3、 ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root';
4、flush privileges;
5、ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root';
6、flush privileges;