Home >Database >Mysql Tutorial >mysql修改用户密码的方法和mysql忘记密码的解决方法_MySQL

mysql修改用户密码的方法和mysql忘记密码的解决方法_MySQL

WBOY
WBOYOriginal
2016-05-27 14:12:061106browse

bitsCN.com

修改密码:


//选择数据库
use mysql;
//修改密码
update user set password=password('新密码') where user='root';
//立即生效
flush privileges

忘记管理员密码:

在my.ini的[mysqld]字段下面加入:

skip-grant-tables

重启mysql服务,这时的mysql不需要密码即可登录数据库
然后进入mysql

use mysql;update user set password=password('新密码') where user='root';
flush privileges

运行之后最后去掉my.ini中的skip-grant-tables,重启mysql即可。

bitsCN.com
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