Home  >  Article  >  Database  >  linux mysql 找回密码

linux mysql 找回密码

WBOY
WBOYOriginal
2016-06-07 18:01:15799browse

linux下mysql忘记密码的解决方法。

1. 停到运行的mysql: /etc/init.d/mysql stop

2. 使用skip-grant-tables这个选项启动MySQL: /usr/bin/mysqld_safe --skip-grant-tables &

3. 现在可以不用密码进入mysql 了。

# myql

> use mysql;

> UPDATE user SET password=password('123456') WHERE user='root'; //密码修改为123456;

> FLUSH PRIVILEGES;

> quit;//退出mysql

4. 重启mysql : /etc/init.d/mysql restart

现在就可以用mysql -uroot -p123456登陆了。



本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/ytz_linuxer/archive/2009/07/03/4320660.aspx
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn