1.修改配置文件

vim /etc/my.cnf

在[mysqld]节点添加

skip-grant-tables

2.重启mysql

3.用空密码进入

mysql -uroot

执行

update mysql.user set authentication_string=password('123') where user='root' and Host = 'localhost';

 flush privileges

systemctl restart  mysqld

 

posted on 2019-05-22 15:58  小强110  阅读(174)  评论(0编辑  收藏  举报