- 关闭验证
/etc/my.cnf-->[mysqld]-->skip-grant-tables
- 重启MySql
service mysql restart
- 登陆MySql
mysql -u root
- 刷新权限
FLUSH PRIVILEGES;
- 更新密码
ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';
- 退出MySql
exit
- 打开验证
/etc/my.cnf-->[mysqld]-->skip-grant-tables
- 重启MySql
service mysql restart
- 登陆MySql
mysql -u root -p --> 123456