2023.07.22 | admin | 124次围观
mysql登录密码忘记超级密码会自动改吗,其实解决办法很简单,只需要在mysql的主配置文件my.cnf里添加一行“跳过授权表”的参数选择即可!
在my.cnf中添加下面一行:
[root@test-huanqiu ~]# vim /etc/my.cnf //在[mysqld]区域里添加
........
skip-grant-tables //跳过授权表
然后重启mysql服务超级密码会自动改吗,即可无密码登录
[root@test-huanqiu ~]# /etc/init.d/mysqld restart
登录后重置密码
[root@test-huanqiu ~]# mysql
mysql> select host,user,password from mysql.user;
+--------------------+------+-------------------------------------------+
| host | user | password |
+--------------------+------+-------------------------------------------+
| localhost | root | *481ACA1BD6D1E86221244904E9C0FABA33B40B84 |
| host-192-168-1-117 | root | |
| 127.0.0.1 | root | |
| ::1 | root | |
| localhost | | |
| host-192-168-1-117 | | |
版权声明
本文仅代表作者观点。
本文系作者授权发表,未经许可,不得转载。
发表评论