禁用mysql权限表
vi /etc/my.cnf
添加如下一行
skip-grant-tables
重启mysql
service mysql restart
进入mysql修改密码
mysql -u root -p
mysql> USE mysql;
mysql> UPDATE mysql.user SET authentication_string = PASSWORD('MyNewPass') WHERE User = 'root' AND Host = 'localhost';
mysql> FLUSH PRIVILEGES;
mysql> quit
取消禁用mysql权限表
vi /etc/my.cnf
# 删除 skip-grant-tables
service mysql restart
版权属于:一名宅。
本文链接:https://zhaiyiming.com/archives/reset-mysql-password.html
转载时须注明出处及本声明