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

    一、以管理员身份打开cmd,停止mysql(Windows)

    net stop mysql

    二、无密码启动

    mysqld --console --skip-grant-tables --shared-memory

     三、登录mysql(再重新打开一个窗口)

    mysql.exe -u root

     四、清空密码

    UPDATE mysql.user SET authentication_string='' WHERE user='root' and host='localhost';

    五、修改密码

    ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '密码';

    六、如果报错

    ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement

    七、执行

    flush privileges;

    八、再修改一次

    ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '密码';

     九、登录,输入密码

    mysql -u root -p

    十、linux重置密码

    修改文件
    vi /etc/my.cnf
    在mysqld下面添加skip-grant-tables
    如下图

     十一、重启mysql后登录

    停止
    systemctl stop mysql.service
    启动
    systemctl start mysql.service
    登录
    mysql -u root -p
    提示输入密码,直接回车

    十二、清空mysql的密码

    use mysql;
    update user set authentication_string = '' where user = 'root';
    清空了密码退出
    quit;

    十三、删除一开始设置的skip-grant-tables,重启mysql

    十四、进入mysql重新设置密码(密码太简单了会报错)

    use mysql;
    ALTER USER 'root'@'%' IDENTIFIED BY '密码';
    quit;
     
  • 相关阅读:
    【02】AJAX XMLHttpRequest对象
    【01】什么是AJAX
    NPM是什么
    nodejs npm常用命令
    angular(转)
    s6 传输层
    s6-9 TCP 定时器
    s6-8 TCP 拥塞控制
    s6-7 TCP 传输策略
    s6-6 TCP 连接释放
  • 原文地址:https://www.cnblogs.com/ki16/p/15247403.html
Copyright © 2011-2022 走看看