zoukankan      html  css  js  c++  java
  • mysql 8.0 密码破解及更新

    遗忘MySQL 8.0数据库的root密码解决办法

    [root@mysql01 ~]# mysql --version        #查看MySQL版本
    mysql  Ver 8.0.18 for linux-glibc2.12 on x86_64 (MySQL Community Server - GPL)
    [root@mysql01 ~]# vim /etc/my.cnf         #编辑主配置文件
    [mysqld]      #在mysqld这行下写入下面内容
    skip-grant-tables
                .................#省略部分内容
    [root@mysql01 ~]# systemctl restart mysqld      #重启MySQL服务,使配置文件生效
    [root@mysql01 ~]# mysql -u root           #跳过密码验证,直接登录数据库
    #将root密码设置
    

    mysql> use mysql;
    Reading table information for completion of table and column names
    You can turn off this feature to get a quicker startup with -A

    Database changed
    mysql> update user set authentication_string='' where user = 'root';
    Query OK, 1 row affected (0.01 sec)
    Rows matched: 1 Changed: 1 Warnings: 0

    mysql> flush privileges;
    Query OK, 0 rows affected (0.01 sec)

    mysql> exit;
    Bye


    #开启密码验证并重新登录数据库 [root@mysql01 ~]# vim /etc/my.cnf #编辑主配置文件 [mysqld] skip-grant-tables #删除此行 [root@mysql01 ~]# systemctl restart mysqld #重启使更改生效 [root@mysql01 ~]# mysql -u root -p #直接登录数据库 mysql> alter user root@localhost identified by 'pwd@111'; mysql> flush privileges; mysql> exit #使用新密码进行登录测试
  • 相关阅读:
    1004 Counting Leaves
    1003 Emergency (25分)
    1002 A+B for Polynomials (25分)
    1001 A+B Format
    Weekly Contest 139
    491. Increasing Subsequences
    488. Zuma Game
    servlet总结
    firefox插件Firebug的使用教程
    KMP---POJ 3461 Oulipo
  • 原文地址:https://www.cnblogs.com/michaelcnblogs/p/15135559.html
Copyright © 2011-2022 走看看