zoukankan      html  css  js  c++  java
  • mysql数据忘记库密码

    忘记数据库密码

    • 1、/etc/my.cof文件中添加第一行 skip-grant-tables
    • 2、重启服务 systemctl restart mysqld
    • 3、mysql不需要密码直接登录
    • 4、修改密码 set password=password('123123');
    • 5、刷新 flush privileges;
    • 6、注释掉/etc/my.cof文件中添加的一行 #skip-grant-tables
    • 7、重启服务 systemctl restart mysqld

    第二种方法

    1、关闭数据库
    2、启动数据库到维护模式
    mysqld_safe --skip-grant-tables --skip-networking &
    3、mysql 直接进入数据库
    4、修改密码 alter user root@'localhost' identified by '1';
    5、报错 ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
    6、 flush privileges;
    7、再次修改密码  alter user root@'localhost' identified by '1';
    8、退出 重新启动数据库
    
  • 相关阅读:
    10月6日动手动脑
    10月5日
    SQL
    bug 对应
    @OneToMany
    SQL Constraints
    SQL级联删除——删除主表同时删除从表——同时删除具有主外键关系的表
    子父表
    取字符串
    SQL中MAX()
  • 原文地址:https://www.cnblogs.com/jiangyatao/p/11008434.html
Copyright © 2011-2022 走看看