win10系统下mysql密码忘了这么解决?
打开命令窗口cmd,输入命令:net stop mysql,停止MySQL服务
二、使用步骤
开启跳过密码验证登录的MySQL服务
代码如下(示例):
1.mysqld --console --skip-grant-tables --shared-memory
2.读入数据
再打开一个新的cmd,无密码登录MySQL,输入登录命令:mysql -u root -p
将密码设置为空,命令如下:
代码如下:
1. use mysql
2. update user set authentication_string='' where user='root';
关闭以-console --skip-grant-tables --shared-memory 启动的MySQL服务
打开命令框,输入:net start mysql 启动MySQL服务
密码已经置空,所以无密码状态登录MySQL,输入登录命令:mysql -u root -p然后直接回车
输入以下代码设置新密码alter user ‘root’@‘localhost’ identified by ‘新密码’;
1. alter user ‘root’@‘localhost’ identified by ‘新密码’;