MySQL5.7忘记root密码

找到MySQL的my.cnf配置文件,在/etc/my.cnf (有些版本是/etc/mysql/my.cnf)在里面增加下面一段信息:

[mysqld]
skip-grant-tables
[root@test001 ~]# systemctl restart mysqld
[root@test001 ~]# mysql -uroot -p
mysql> use mysql;
mysql> update mysql.user set authentication_string=password('Kd8k&dfdl023') where user='root';
mysql> flush privileges;
mysql> exit

» 转载请注明本文链接:https://blog.daoshengtech.cn/archives/730.html
» 本文已同步至独立博客:Java地带 » 《MySQL5.7忘记root密码》
» 更多精彩文章,移步☞☞☞《Java地带》☜☜☜

你可能感兴趣的:(MySQL5.7忘记root密码)