很遗憾的告诉你,你网上查到的各种改my.enf ,各种update,在新版MYSQL中,统统失效。

解决方法,如下:

1.

[root@yisu-5f735cb14d716 ~]# service mysqld start

Redirecting to /bin/systemctl start mysqld.service

[root@yisu-5f735cb14d716 ~]# mysql -v

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.22 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. Reading history-file /root/.mysql_history
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

3.在尝试切换database的时候,mysql已经很友好的提示,使用alter user改密码:

mysql> use mysql;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.

4.那我们就改吧。

mysql> alter user 'root'@'localhost' identified by 'Li234*&……F&%';
--------------
alter user 'root'@'localhost' identified b 'Li234*&……F&%'
-------------- Query OK, 0 rows affected (0.01 sec)

5.flush权限,结束

mysql> flush privileges;
--------------
flush privileges
-------------- Query OK, 0 rows affected (0.01 sec) mysql> quit
Writing history-file /root/.mysql_history
Bye

6.登录测试。

MYSQL8以上修改初始root密码的方法的更多相关文章

  1. 修改mysql root密码的方法

    方法1: 用SET PASSWORD命令 首先登录MySQL. 格式:mysql> set password for 用户名@localhost = password('新密码'); 例子:my ...

  2. navicat连接My SQL时忘记root密码处理方法

    前端时间安装完My SQL5.6以后很长时间没用过,用navicat连接时有错误提示 应该是密码错误了,但是忘记了root的密码. 在网上找了很久,终于找到修改root密码的方法并修改成功. 1. 关 ...

  3. 不重启修改mysql root密码

    不重启修改mysql root密码 --------------------2014/09/28 一.一般忘记密码的解决办法,需要重启Mysql1.skip-grant-tables我们常用的方法是使 ...

  4. MySQL 忘记root密码解决方法,基于Ubuntu 14.10

    忘记MySQL root密码解决方法,基于Ubuntu 14.10 忘了mysql密码,从网上找到的解决方案记录在这里. 编辑mysql的配置文件/etc/mysql/my.cnf,在[mysqld] ...

  5. RHEL6.4找回root密码的方法

    1.先在系统启动的时候提示:press any key to enter menu 时按下e键(其实其他键也可以,只不过我习惯e键而已) 2.进入如下界面: 3.按上下箭头方向键选中第二项,按e键,进 ...

  6. 修改mysql root密码,在workbench中导入.sql文件

    修改mysql root密码: 1.如果没有配置环境变量,在 \Program Files\MySQL\MySQL Server 8.0\bin 文件下 Shit+右键打开 Powershell 窗口 ...

  7. Mysql5.7忘记root密码及mysql5.7修改root密码的方法

    转自:http://www.jb51.net/article/77858.htm 关闭正在运行的 MySQL : ? 1 [root@www.woai.it ~]# service mysql sto ...

  8. Mysql修改设置root密码的命令及方法

    方法一:使用SQL语句命令UPDATE 需用到Mysql自带的加密函数PASSWORD(string),该函数对一个明文密码进行加密,但不能解密.专门用于mysql.user(用户权限表)中设置密码, ...

  9. mysql 修改root密码多种方法

    方法1: 用SET PASSWORD命令  mysql -u root  mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpa ...

  10. mysql修改root密码的方法

    方法1: 用SET PASSWORD命令 首先登录MySQL. 格式:mysql> set password for 用户名@localhost = password('新密码'); 例子:my ...

随机推荐

  1. Spring 之 RestTemplate VS WebClient 发送 HTTP请求

    WebClient 依赖 <dependency> <groupId>org.springframework.boot</groupId> <artifact ...

  2. Fio工具详解【强大的IO性能压测工具】

    Fio压测工具操作 fio -name=iouring_test -filename=/mnt/vdd/testfile -iodepth=128 -thread -rw=randread -ioen ...

  3. ftrace irqs跟踪器

    当中断被关闭(俗称关中断)了,CPU就不能响应其他的事件,如果这时有一个鼠标中断,要在下一次开中断时才能响应这个鼠标中断,这段延迟称为中断延迟.向current_tracer 文件写入 irqsoff ...

  4. 34.vue响应式

    响应式就是 数据发生变化,ui界面自动更新内容 : vue响应式的实现是在 创建vue实例的时候,遍历data数据,通过 Object.defineProperty给每个数据添加 getter 和 s ...

  5. 让容器通信变得简单:深度解析 Containerd 中的 CNI 插件

    作者:尹珉,KubeSphere Ambassador & contributor,KubeSphere 社区用户委员会杭州站站长. 引言 在上一篇文章中,我们详细讨论了 Kubernetes ...

  6. HTTP常用返回结果状态码

    摘编自<图解HTTP> HTTP状态码负责表示客户端 HTTP请求的返回结果.标记服务器端的处理是否正常.通知出现的错误等工作.状态码的职责是当客户端向服务器端发送请求时,描述返回的请求 ...

  7. Machine Learning Week_4 Neural Networks: Representation

    目录 0 Neural Networks: Representation 1 Motivations 1.1 Non-linear Hypotheses 1.2 Neurons and the Bra ...

  8. springboot实现验证码校验

    验证码校验共三步 1.创建验证码 2.发送验证码 3.验证码校验 创建生成验证码的工具类 public class RandomValidateCode { private Random random ...

  9. Web开发核心

    文章目录 1.http协议简介 2.http协议特性 3.http请求和响应协议 4.最简单的Web程序 5.基于flask搭建web⽹站 6.浏览器开发者⼯具(重点) 1.http协议简介 HTTP ...

  10. 题解:USACO23OPEN-Silver

    题解:USACO23OPEN-Silver T1 Milk Sum 给定一个长度为 \(N\) 的序列 \(a_1,a_2,...,a_n\),现在给出 \(Q\) 次操作每次将 \(a_x\) 修改 ...