Mysql 忘记密码解决步骤

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/GJX_BLOG/article/details/85231293
  1. 停止mysql服务:service mysqld stop

  2. 执行命令:mysqld_safe --skip-grant-tables & mysql -uroot -p 回车 安全模式进入

         > use mysql;
    
         > update user set password=PASSWORD("newpass")where user="root"; //修改密码
    
         > flush privileges; //刷新权限
    
         > quit //退出
    
  3. 重启mysql服务:service mysqld restart

  4. 链接数据库:mysql -uroot -p 新密码

猜你喜欢

转载自blog.csdn.net/GJX_BLOG/article/details/85231293