zoukankan      html  css  js  c++  java
  • mysql 8.0忘记root密码

    1、修改参数文件添加以下内容
    skip-grant-tables
    
    2、关闭数据库
    [root@node01 ~]# /etc/init.d/mysqld8 stop
    Shutting down MySQL. SUCCESS!
    
    3、重启数据库
    [root@node01 ~]# /etc/init.d/mysqld8 start
    Starting MySQL.. SUCCESS!
    
    4、修改用户密码为空
    mysql> update mysql.user set authentication_string='' where user='root' and host='localhost';
    Query OK, 1 row affected (0.01 sec)
    Rows matched: 1  Changed: 1  Warnings: 0
    
    mysql> flush privileges;
    Query OK, 0 rows affected (0.02 sec)
    
    5、关闭数据库
    [root@node01 ~]# /etc/init.d/mysqld8 stop
    Shutting down MySQL. SUCCESS!
    
    6、去掉参数文件中以下内容
    skip-grant-tables
    
    7、启动数据库
    [root@node01 ~]# /etc/init.d/mysqld8 start
    Starting MySQL.. SUCCESS!
    
    8、使用空密码登录数据库
    [root@node01 ~]# mysql
    Welcome to the MySQL monitor.  Commands end with ; or g.
    Your MySQL connection id is 8
    Server version: 8.0.22 MySQL Community Server - GPL
    
    Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
    
    Oracle is a registered trademark of Oracle Corporation and/or its
    affiliates. Other names may be trademarks of their respective
    owners.
    
    Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
    
    mysql>
    
    9、修改用户密码
    mysql> alter user 'root'@'localhost' identified by 'mysql';
    Query OK, 0 rows affected (0.00 sec)
    
    mysql> flush privileges;
    Query OK, 0 rows affected (0.00 sec)
    
    10、使用新密码登录数据库
    [root@node01 ~]# mysql -uroot -pmysql
    mysql: [Warning] Using a password on the command line interface can be insecure.
    Welcome to the MySQL monitor.  Commands end with ; or g.
    Your MySQL connection id is 9
    Server version: 8.0.22 MySQL Community Server - GPL
    
    Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
    
    Oracle is a registered trademark of Oracle Corporation and/or its
    affiliates. Other names may be trademarks of their respective
    owners.
    
    Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
    
    mysql>
    

      

  • 相关阅读:
    HTML5游戏引擎Phaser初体验
    React+Node.js+Express+mongoskin+MongoDB
    React的一个简单示例
    在线白板,基于socket.io的多人在线协作工具
    使用node-webkit开发exe窗口程序
    使用Node.js的socket.io模块开发实时web程序
    dota BP练习工具开发:一个C/S多用户程序
    SQL注入之延迟盲注
    CTFHUB之gopher协议实现SSRF
    python的蟒蛇绘制
  • 原文地址:https://www.cnblogs.com/orcl-2018/p/13962442.html
Copyright © 2011-2022 走看看