1,vi /etc/my.cnf
[mysqld]下加入參數skip-grant-tables 保存退出。
2,重啓mysqlmysql
- [root@21yunwei src]# /etc/init.d/mysqld restart
- Shutting down MySQL.. [ OK ]
- Starting MySQL. [ OK ]
3,登陸mysql修改密碼。經過mysql -uroot -p 直接回車空密碼登陸mysql後,採用update 修改mysq.user表:sql
- mysql> use mysql;
- Database changed
- mysql> update user set authentication_string=PASSWORD('123456') where User='root';
- Query OK, 1 row affected, 1 warning (0.01 sec)
- Rows matched: 1 Changed: 1 Warnings: 1
- mysql> flush privileges;
- Query OK, 0 rows affected (0.00 sec)
4,登陸測試。
編輯/etc/my.cnf註釋或刪除[mysqld]下加入的參數skip-grant-tables 保存退出後重啓mysql,從新登陸測試,mysql 5.7.1X的root密碼破解重置成功。測試