更新时间:2022-08-14 18:36:10
原文章地址:https://blog.csdn.net/qq_35202206/article/details/81092430
此文章是自己修改后,重新写的一篇文章 如果觉得不够详细可以参考上面的地址。
修改前建议创建快照 ,以防错误修改 导致系统无法启动
下面操作是centos 7.6版本的,mysql是5.7 其他版本可以参考下。
vi /etc/my.cnf
systemctl restart mysqld
update mysql.user set authentication_string=password('123456789sW!') where user='root' ;
systemctl restart mysqld
vi /etc/my.cnf
,找到 skip-grant-tables 删掉 然后按照上面的方法保存wq!systemctl restart mysqld