mysql密码破译

MySQL破解密码的步骤:(只能root用户操作)
1.修改配置文件,加入一下内容
skip-grant-tables

[root@localhost ~]# vim /etc/my.cnf
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html

[mysqld]
skip-grant-tables  //添加此行内容,表示跳过授权表,跳过密码验证直接进入数据库

2.重启mMySQL

[root@localhost ~]# systemctl restart mysqld

3.修改密码

[root@localhost ~]# mysql -uroot -p
Enter password:   //这里直接回车
......
mysql>    //出现这个就是进到数据库里了
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> alter user 'root'@'localhost' identified by '123456';
Query OK, 0 rows affected (0.00 sec)

4.恢复配置文件,删除skip-grant-tables

[root@localhost ~]# vim /etc/my.cnf
skip-grant-tables  //删除此行

5.重启MySQL

[root@localhost ~]# systemctl restart mysqld

6.验证新密码是否能登录

[root@localhost ~]# mysql -uroot -p123456
......
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> 
posted @ 2022-06-29 02:03  夏天的海  阅读(331)  评论(0)    收藏  举报