#vi /etc/my.cnf
添加
[mysqld]
skip-grant-tables
重启MySql服务
#MySql -p
直接进入mysql
update mysql.user set password=password('123456') where User="root" and Host="localhost";
flush privileges; #刷新系统授权表
grant all on *.* to 'root'@'localhost' identified by '123456' with grant option;
有些版本user表password字段为authentication_string
#vi /etc/my.cnf
删除
[mysqld]
skip-grant-tables
重启MySql服务