美文网首页
mysql 8 忘记密码 修改密码

mysql 8 忘记密码 修改密码

作者: 水妖 | 来源:发表于2020-12-22 17:04 被阅读0次
//1.停止服务(C:\Windows\System32\cmd.exe 右键-管理员身份运行) 
net stop mysql
//2.忽略密码(执行后处于等待状态,不要关闭)
mysqld --console --skip-grant-tables --shared-memory
//3.免密登陆(新窗口打开)
mysql -u root
//4.修改密码-并刷新(修改完成)
alter user 'root'@'localhost' identified  with mysql_native_password by '123456';
flush privileges;




//如果4 提示以下错误信息  继续往下走
ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
//5.清空密码
update mysql.user set authentication_string = '' where user = 'root';
//刷新-并退出
flush privileges;
exit;
//6.退出步骤2的命令窗(操作:在命令窗按下 ctrl+c 键 或 直接关闭)
//7.启动服务 
net start mysql
//8.打开mysql  密码输入直接enter键
mysql -uroot -p
//9.执行步骤4

相关文章

网友评论

      本文标题:mysql 8 忘记密码 修改密码

      本文链接:https://www.haomeiwen.com/subject/jjbsnktx.html