1.管理员身份打开cmd,进入dos
2.停止mysql服务 命令:net stop mysql
3.无密码启动 命令:mysqld --console --skip-grant-tables --shared-memory
4.另启一个dos窗口,无密码登录 命令:mysql -u root
5.清空密码 命令:update mysql.user set authentication_string='' where user='root' and host='localhost'; 注意:authentication_string采用的是plugin加密方式,故设置为空,不要设置为其他值
6.启动服务 关闭打开的两个dos窗口,然后以管理员身份重新打开一个dos窗口,启动服务 命令:net start mysql
7.无密码登录 命令:mysql -u root
8.重新设置密码 修改后,就可以用新密码登录了。 命令:alter user root@localhost identified by 'root';
9.退出mysql服务 命令:quit;
10.用修改后的用户名密码登陆 命令:mysql -u root -proot
1.管理员身份打开cmd,进入dos
2.停止mysql服务 命令:net stop mysql
3.无密码启动 命令:mysqld --console --skip-grant-tables --shared-memory
4.另启一个dos窗口,无密码登录 命令:mysql -u root
5.清空密码 命令:update mysql.user set authentication_string='' where user='root' and host='localhost'; 注意:authentication_string采用的是plugin加密方式,故设置为空,不要设置为其他值
6.启动服务 关闭打开的两个dos窗口,然后以管理员身份重新打开一个dos窗口,启动服务 命令:net start mysql
7.无密码登录 命令:mysql -u root
8.重新设置密码 修改后,就可以用新密码登录了。 命令:alter user root@localhost identified by 'root';
9.退出mysql服务 命令:quit;
10.用修改后的用户名密码登陆 命令:mysql -u root -proot
|
|
来自: 条山石头 > 《biancheng》