• Mysql密码忘记修复


    一,忘记mysql的root密码

    方法流程:

    1.关闭正在运行的MySQL服务。
    2.打开DOS窗口,转到mysql\bin目录。
    3.输入mysqld --skip-grant-tables 回车。--skip-grant-tables 的意思是启动MySQL服务的时候跳过权限表认证。
    4.再开一个DOS窗口(因为刚才那个DOS窗口已经不能动了),输入mysql回车,如果成功,将出现MySQL提示符 >。
    5.连接权限数据库: use mysql; 。
    6.改密码:update user set password=password("新密码") where user="root";(别忘了最后加分号) 。
    7.刷新权限(必须步骤):flush privileges; 
    8.退出mysql  quit;

    第一个DOS界面

    1. [root@localhost bin]# mysqld --skip-grant-tables
    2. 2022-10-21T13:41:43.458128Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
    3. 2022-10-21T13:41:43.458200Z 0 [Note] --secure-file-priv is set to NULL. Operations related
    4. ..........
    5. 2022-10-21T13:41:43.548725Z 0 [Note] Plugin 'FEDERATED' is disabled.
    6. 2022-10-21T13:41:43.551203Z 0 [Warning] Failed to set up SSL because of the following SSL library error: SSL context is not usable without certificate and private key

    开启第二个DOS界面

    1. [root@localhost ~]# mysql
    2. Welcome to the MySQL monitor. Commands end with ; or \g.
    3. Your MySQL connection id is 3
    4. Server version: 5.7.20 MySQL Community Server (GPL)
    5. mysql> use mysql;
    6. mysql> update user set password=password("新密码") where user="root";
    7. mysql> flush privileges;
    8. mysql> quit;

    二,报错 ERROR 1054 (42S22): Unknown column 'password' in 'field list'

            使用上面的修改密码的方式,提示错误

    1. mysql> update user set password=PASSWORD('要修改的密码') where user='root';
    2. ERROR 1054 (42S22): Unknown column 'password' in 'field list'

            后来去MySQL官网查了一下手册,发现MySQL5.7版本后,password这个字段被改成 authentication_string,OK原因出来,那么我去修改一下字段就OK了,所以正确的命令应该是这样的

    mysql> update user set authentication_string=password("您要修改的密码") where user="root";
    

            刷新mysql权限

    mysql> flush privileges;
  • 相关阅读:
    线程安全
    JavaScript中的Generator函数及其使用方式
    python关键字
    创维E900-S-普通版-MV100纯净通刷_卡刷固件包
    Verilog实战学习到RiscV - 4 : ICEStick 评估板计数器
    【JavaEE】HTTP协议
    GPT-5:人工智能的下一个前沿即将到来
    js之页面列表加载常用方法总结
    groupby的复杂用法
    前端周刊第二十二期
  • 原文地址:https://blog.csdn.net/weixin_53678904/article/details/127454723