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>

  

最新文章

  1. shell 中的与、或表达式
  2. JAVA新手笔记 Intent对象和Bundle对象
  3. Liferay 6.2 改造系列之十:修改系统登录相关配置
  4. 为什么不能把委托(delegate)放在一个接口(interface)当中?
  5. oracle视图如何使用
  6. HDU 1856
  7. [转载] ubuntu下定制Vim/Gvim及使用技巧
  8. 关于iOS自定义返回按钮右滑返回手势失效的解决:
  9. Javaweb入门20160301 ---xml入门
  10. css控制图片变灰色,彩色
  11. nginx_http核心模块(二)
  12. java 文件字符输入、输出流
  13. poj 2455 二分+最大流
  14. tp5无法隐藏index.php入口文件
  15. 笔记:Hibernate 查询缓存
  16. java 线程方法 ---- join()
  17. 京东618:Docker扛大旗,弹性伸缩成重点 (2015-06-23)
  18. python六十八课——网络编程之UDP协议
  19. Spring Boot 2 (十):Spring Boot 中的响应式编程和 WebFlux 入门
  20. VBA二次学习笔记(3)——批量合并单元格

热门文章

  1. Spring Cloud Security OAuth2.0 认证授权系列(一) 基础概念
  2. BurpSuite 抓安卓app包
  3. 面试官:小伙子,给我说一下spring框架吧
  4. 标准库之collections
  5. 微课制作软件Camtasia中如何添加并编辑字幕?
  6. Vegas转场功能的妙用,让片头转场更酷炫
  7. 题解 洛谷 P2612 【[ZJOI2012]波浪】DP+高精
  8. 浅谈代理模式与java中的动态代理
  9. DRF使用Serializer来进行序列化和反序列化操作
  10. python核心高级学习总结7---------正则表达式