MySQL5.7忘记root密码如何重置
-
修改配置文件并重启:
1
[root@localhost ~]# vi /etc/my.cnf在[mysqld]添加一行
1
skip-grant-tables重启服务
1
[root@localhost ~]# systemctl restart mysqld -
进入mysql修改root密码:
1
2[root@localhost ~]# mysql -uroot
mysql> update mysql.user set authentication_string=password('newPassWord!123') where user='root' and host='localhost';* mysql5.7密码要求
大小写字母、数字和特殊符号 -
退出mysql,重新修改
/etc/my.cnf,删掉skip-grant-tables -
重启服务
1
[root@localhost ~]# systemctl restart mysqld -
使用新密码登录:
1
[root@localhost ~]# mysql -uroot -p
MySQL5.7忘记root密码如何重置
https://blog.supersource.top/mysql_5_7_reset_password/