Home > Database > Mysql Tutorial > 忘记Mysql的root密码怎么处理? (转)

忘记Mysql的root密码怎么处理? (转)

WBOY
Release: 2016-06-07 16:26:54
Original
1106 people have browsed it

忘记Mysql的root密码怎么办? (转) 解决方法: 1、打开cmd,用net start命令查看是否开启了mysql服务,如果开启,用net stop mysql 命令关闭mysql 2、进入mysql的安装目录下的bin目录,例如:E:\Program Files\MySQL\MySQL Server 5.6\bin 执行: [sql] vie

忘记Mysql的root密码怎么办? (转)

解决方法:

1、打开cmd,用net start命令查看是否开启了mysql服务,如果开启,用net stop mysql 命令关闭mysql

2、进入mysql的安装目录下的bin目录,例如:E:\Program Files\MySQL\MySQL Server 5.6\bin

执行:

[sql] view plaincopyprint?
  1. mysqld -nt --skip-grant-tables
mysqld -nt --skip-grant-tables
Copy after login

?

?

目的是跳过权限检查启动mysql

?

3、重新打开一个cmd,输入mysql -uroot ,这时没有使用密码登陆进mysql

4、修改mysql的root密码:

?

[sql] view plaincopyprint?
  1. update mysql.usersetpassword=PASSWORD('你的新密码') whereUser='root';
update mysql.user set password=PASSWORD('你的新密码') where User='root';
Copy after login
[sql] view plaincopyprint?
  1. flush privileges;
flush privileges;
Copy after login
[sql] view plaincopyprint?
  1. quit
quit
Copy after login

现在就可以使用刚刚设置的密码登陆了。

5、打开cmd进入到E:\Program Files\MySQL\MySQL Server 5.6\bin,执行:

mysqladmin-u root -p shutdown

6、再打开net start mysql这样就可以正常打开mysql了,如果没有执行第5步,会报1067的错误。

Related labels:
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