密码重置

可以跳过密码

[mysqld]
skip-grant-tables

或者使用命令行

--skip-grant-tables

重置用户密码

-- 方式 1
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'new_password'; 
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'new_password'; 

-- 方式 2 (推荐)
FLUSH PRIVILEGES;
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('new_password');
SET PASSWORD FOR 'root'@'%' = PASSWORD('new_password');