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

    一、更改my.cnf配置文件

    0、MySQL 版本查看

    mysql --version

    1、用命令编辑/etc/my.cnf配置文件,即:vim /etc/my.cnf 或者 vi /etc/my.cnf 或者 nano /etc/my.cnf

    2.在[mysqld]下添加skip-grant-tables,然后保存并退出

    3.重启mysql服务:service mysqld restart

    二、更改root用户名

    1、重启以后,执行mysql命令进入mysql命令行

    2、修改root用户密码

    进入mysql命令行:

    mysql -u root -p

    update user set password=password("*******") where user="*******"; #修改密码报错
    ERROR 1054 (42S22): Unknown column 'password' in 'field list'
    # 5.7版本下的mysql数据库下已经没有password这个字段了,password字段改成了authentication_string
    update mysql.user set authentication_string=password('*******') where user='*******';  #修改密码成功
    flush privileges;  #立即生效

    exit; #退出

    #重新登录
    mysql -u ******* -p #以该用户登录成功.
    Enter password: ********






     



     

     

     

  • 相关阅读:
    luogu P4009 汽车加油行驶问题
    luogu P4015 运输问题
    luogu P2763 试题库问题
    luogu P4011 孤岛营救问题
    luogu P2765 魔术球问题
    linux 网卡
    linux yum错误
    ubuntu登录备注信息
    Ubuntu网卡配置
    linux 走三层内网添加静态路由
  • 原文地址:https://www.cnblogs.com/EveningWind/p/10130314.html
Copyright © 2011-2022 走看看