修改配置文件
vim /etc/
my.cnf
[mysqld]
skip-grant-tables
重新启动mysqld
service mysqld restart
修改root密码:
mysql>
update mysql.user set authentication_string=password(
'123') where user=
'root' and Host =
'localhost';
mysql>
flush privileges;
完后再把skip-grant-tables 去掉,重启mysql 使用新密码登陆即可!
service mysqld restart
转载于:https://www.cnblogs.com/powerwu/articles/11376584.html