Home > Database > Mysql Tutorial > Windows下忘记MySQL root密码的解决方法

Windows下忘记MySQL root密码的解决方法

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-07 16:08:47
Original
1111 people have browsed it

1.打开MySQL配置文件 my.ini中,添加上skip-grant-tables,可以添加到文件的末尾或者是这添加到[mysqld]的下面。 2.然后重启MYSQL

1.打开MySQL配置文件 my.ini中,添加上skip-grant-tables,可以添加到文件的末尾或者是这添加到[mysqld]的下面。

2.然后重启MYSQL服务

windows环境中:
net stop MySQL 
net start MySQL

如果出现不是有效的命令,,注意环境变量的配置

3.设置ROOT密码

在命令上输出

Windows下忘记MySQL root密码的解决方法

注意选择数据库, use mysql。

现在我们执行如下语句把root密码更新为123456:
update user set password=PASSWORD("123456") where user='root';

quit 退出MySQL

4.还原配置文件并重启

再把上面的“skip-grant-tables”删掉,重启服务

本文永久更新链接地址:

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template