且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Gnu/Linux下忘记MySQL密码

更新时间:2022-09-17 17:19:44

在Gnu/Linux下忘记了MySQL的密码了,怎么找回呢?只需要经过以下简单的步骤,即可找回,

1
2
3
4
5
6
7
8
[root@localhost ~]# service mysqld stop
[root@localhost ~]# killall -TERM mysqld
[root@localhost ~]# mysqld_safe --skip-grant-tables &
[root@localhost ~]# mysql
mysql> use mysql;
mysql> update user set password('new_pass') where user="root";
mysql> exit
[root@localhost ~]# service mysqld restart



本文转自   bigstone2012  51CTO博客,原文链接:http://blog.51cto.com/lavenliu/1422242