Home > Database > Mysql Tutorial > windows环境中mysql忘记root密码的解决方法详解_MySQL

windows环境中mysql忘记root密码的解决方法详解_MySQL

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-01 13:24:25
Original
1214 people have browsed it

bitsCN.com 一朋友告急:mysql 忘记root密码了 让我帮忙给看看,因为没有接触过mysql 所以从网上找了一下信息
经我亲身实践  已经成功!mysql版本是5.1。
以下是从网上找的mysql密码修改的信息:
参考文章:
windows下重置Mysql Root密码的方法
mysql修改密码以及忘记密码
1、 首先检查mysql服务是否启动,若已启动则先将其停止服务,可在开始菜单的运行,使用命令:
net stop mysql
打开第一个cmd1窗口,切换到mysql的bin目录,运行命令:
mysqld --defaults-file="C:/Program Files/MySQL/MySQL Server 5.1/my.ini" --console --skip-grant-tables
注释:
该命令通过跳过权限安全检查,开启mysql服务,这样连接mysql时,可以不用输入用户密码。  此时已经开启了mysql服务了!
这个窗口保留 不关闭。
2、打开第二个cmd2窗口,连接mysql:
输入命令:
mysql -u root -p
出现:
Enter password:
在这里直接回车,不用输入密码。
然后就就会出现登录成功的信息,
使用命令:
show databases;
使用命令切换到mysql数据库:
use mysql;
使用命令更改root密码:
UPDATE user SET Password=PASSWORD('newpassword') where USER='root';
刷新权限:
FLUSH PRIVILEGES;
然后退出,重新登录:
quit
重新登录: 可以关掉之前的cmd1 窗口了。然后用net start mysql 启动服务
mysql -u root -p
出现输入密码提示,输入新的密码即可登录:
Enter password: ***********
显示登录信息: 成功  就一切ok了
bitsCN.com

Related labels:
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
Latest Issues
Can Windows be learned?
From 1970-01-01 08:00:00
0
0
0
Install PHP in windows environment
From 1970-01-01 08:00:00
0
0
0
zookeeper extension under windows
From 1970-01-01 08:00:00
0
0
0
Can I play vim happily on Windows?
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template