zoukankan      html  css  js  c++  java
  • mysql 重置密码

    1、停止数据库

      net stop mysql

    2、打开cmd窗口,运行如下命令:

      mysqld  --skip-grant-tables


    3、打开第二个cmd,连接mysql,运行如下命令:
      mysql -uroot -p

      遇到需要输入密码时,直接回车,就可以进去

    4、连接好mysql之后,运行命令

      show databases;

    5、继续使用如下命令

    use mysql;

    6、使用命令修改root密码(两种情况)

    • 版本为5.7以前的mysql,运行这条语句(此处的新密码为你要设置的新密码)

      UPDATE user SET Password=PASSWORD('新密码') where USER='root';

      

    • 版本为5.7及其之后的运行这条语句

      UPDATE user SET authentication_string=PASSWORD('新密码') where USER='root';

      

    原因是:mysql中密码的字段名由password变为了authentication_string

    For Mysql before 5.7 it is "password"

    Since MySQL 5.7 it is "authentication_string"

     

    7、刷新权限

    FLUSH PRIVILEGES;

    8、退出数据库

    quit

    9、重新登录数据库,并输入密码就可以了

    mysql -uroot -p


    首发于:https://blog.csdn.net/qq_41941317/article/details/90300022

     
  • 相关阅读:
    Django项目总结:Model高级
    Django项目总结:Response和Cookie
    数据库:索引
    数据库:视图
    数据库:约束
    MySQL:常用命令
    MySQL:安装和连接
    时间戳和正则表达式
    Java 类的概念与使用
    JAVA复习题
  • 原文地址:https://www.cnblogs.com/yx88/p/11257912.html
Copyright © 2011-2022 走看看