zoukankan      html  css  js  c++  java
  • Linux下Mysql5.7忘记密码

    一、问题

    linux下的mysql5.7忘记密码

    二、解决

    • 第一步:打开mysql5.7的配置文件my.cnf,并在里面增加一行:skip-grant-tables   保存并退出(:wq)
    [root@iz09a32x1sghz3z ~]# vi /etc/my.cnf
    

    image

    • 第二步:重启mysql
    [root@iz09a32x1sghz3z ~]# service mysqld restart
    • 第三步:登录mysql并且修改密码

    用root账号登录: [root@iz09a32x1sghz3z ~]# mysql -u root

    使用mysql中的mysql数据库: mysql> use mysql;

    修改密码:  update user set authentication_string = password("Szfore_68638") where user="root" ;

    刷新数据库: flush privileges;

    退出: quit;

    注意:mysql5.7的user表中的password字段已经改成了authentication_string 字段了。

    这时候,需要输入的命令是update user set authentication_string = password("Szfore_68638") where user="root" ;

    • 第四步:打开mysql5.7的配置文件my.cnf,把刚增加这行:skip-grant-tables  删除掉 保存并退出(:wq)
    • 第五步:重新启动mysql,即可用修改好的密码登录了。
    [root@iz09a32x1sghz3z ~]# service mysqld restart
  • 相关阅读:
    jQuery_第一章_JavaScript基础
    呵呵双钻
    MINIDVD
    幸运抽奖
    三章
    复习
    三种循环
    百文买百鸡
    1~100的奇数和
    Python memcache和redis
  • 原文地址:https://www.cnblogs.com/helf/p/10845122.html
Copyright © 2011-2022 走看看