【转载请注明出处】:https://www.jianshu.com/p/8a6f32e37a87
用命令编辑/etc/my.cnf配置文件
在[mysqld]下添加skip-grant-tables,然后保存并退出,然后重启
service mysqld restart
连接mysql服务
mysql
update mysql.user set authentication_string=password('123qwe') where user='root' ;
flush privileges;
quit;
如果密码正确,但是access denied

grant all privileges on . to 'root'@'localhost' identified by '123qwe';
用命令编辑/etc/my.cnf配置文件,去掉skip-grant-tables
重启mysql服务
service mysqld restart
【转载请注明出处】:https://www.jianshu.com/p/8a6f32e37a87

网友评论