mysql破解密码
1.关闭mysql服务
[root@localhost ~]# service mysql stop
Shutting down MySQL..... [ OK ]
2.跳过授权表mysql.user 和 mysql.db
[root@localhost ~]# mysqld_safe --skip-grant-tables --user=mysql &
[1] 27937
121230 19:27:55 mysqld_safe Logging to '/usr/local/mysql/data/localhost.localdomain.err'.
121230 19:27:55 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
3.不用密码直接登录
[root@localhost ~]# mysql -uroot
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.5.29-log Source distribution
Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
4.设置root密码
mysql> update mysql.user set password=password("123456") where user="root" and host = "localhost";
Query OK, 0 rows affected (0.01 sec)
Rows matched: 1 Changed: 0 Warnings: 0
mysql> exit
Bye