创建个网站需要多少钱/广点通投放平台
此文参考官方文档一步一步记录安装到正常运行全过程
安装环境:centos7
mysql版本:8.0.35
安装过程主要参考下面两边文章:
1.官方文档
https://dev.mysql.com/doc/refman/8.0/en/linux-installation-yum-repo.html
2.linux yum安装mysql8
安装过程大概有以下几步:
1.查找mysql源链接
2.安装mysql源(仓库)
3.安装mysql服务
4.启动mysql服务
5.获取并修改密码
6.防火墙放行、远程登录和设置
因为我的这个centos之前用宝塔装过mysql5.6版本,所以走了一点弯路,过程也记录下来了。如果也是同样情况,建议一开始就卸载旧版本再安装8.0版本。
另外,我避开下面的坑,又重新记录了在一台centosh上mysql8.0过程,可以参考下面我写的另外一篇文章:
《在CentOS上用yum方式安装MySQL8真实全过程记录(顺利版本)》
一、查找mysql源链接
(MySQL Yum Repository,找MySQL官方yum仓库地址并下载)
根据官方文档提示,进入到mysql yum仓库的下载页面(如下图)
https://dev.mysql.com/downloads/repo/yum/
因为我的CentOS版本是7,所以选择对应的版本,点击download进入下载页面(如下图)
提示注册,不需要注册,我们直接复制下面的下载地址即可。
复制到的地址为:
https://repo.mysql.com//mysql80-community-release-el7-11.noarch.rpm
二、安装mysql源(仓库)
[root@szaliyun ~]# yum localinstall https://repo.mysql.com//mysql80-community-release-el7-11.noarch.rpm
已加载插件:fastestmirror
mysql80-community-release-el7-11.noarch.rpm | 14 kB 00:00:00
正在检查 /var/tmp/yum-root-hMU7pD/mysql80-community-release-el7-11.noarch.rpm: mysql80-community-release-el7-11.noarch
/var/tmp/yum-root-hMU7pD/mysql80-community-release-el7-11.noarch.rpm 将被安装
正在解决依赖关系
--> 正在检查事务
---> 软件包 mysql80-community-release.noarch.0.el7-11 将被 安装
--> 解决依赖关系完成依赖关系解决===============================================================================================================================================================================================Package 架构 版本 源 大小
===============================================================================================================================================================================================
正在安装:mysql80-community-release noarch el7-11 /mysql80-community-release-el7-11.noarch 17 k事务概要
===============================================================================================================================================================================================
安装 1 软件包总计:17 k
安装大小:17 k
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction正在安装 : mysql80-community-release-el7-11.noarch 1/1 验证中 : mysql80-community-release-el7-11.noarch 1/1 已安装:mysql80-community-release.noarch 0:el7-11 完毕!
过程中提问是否安装,输入y后回车。
三、安装mysql服务
列出已启用的包含 “mysql.-community.” 关键字的软件包仓库
[root@szaliyun ~]# yum repolist enabled
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
源标识 源名称 状态
base/7/x86_64 CentOS-7 10,070+2
epel/x86_64 Extra Packages for Enterprise Linux 7 - x86_64 13,788+2
extras/7/x86_64 CentOS-7 518
mysql-connectors-community/x86_64 MySQL Connectors Community 234
mysql-tools-community/x86_64 MySQL Tools Community 102
mysql80-community/x86_64 MySQL 8.0 Community Server 446
updates/7/x86_64 CentOS-7 5,359+8
repolist: 30,517
[root@szaliyun ~]# yum repolist enabled | grep "mysql.*-community.*"
mysql-connectors-community/x86_64 MySQL Connectors Community 234
mysql-tools-community/x86_64 MySQL Tools Community 102
mysql80-community/x86_64 MySQL 8.0 Community Server 446
[root@szaliyun ~]#
yum repolist enabled 用于列出已启用的软件包仓库,grep “mysql.-community.” 用于过滤出包含 “mysql.-community.” 关键字的软件包仓库。
安装
[root@szaliyun ~]# yum install mysql-community-server
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
base | 3.6 kB 00:00:00
epel | 4.7 kB 00:00:00
extras | 2.9 kB 00:00:00
mysql-connectors-community | 2.6 kB 00:00:00
mysql-tools-community | 2.6 kB 00:00:19
mysql80-community | 2.6 kB 00:00:04
updates | 2.9 kB 00:00:00
正在解决依赖关系
--> 正在检查事务
---> 软件包 mysql-community-server.x86_64.0.8.0.35-1.el7 将被 安装
--> 正在处理依赖关系 mysql-community-common(x86-64) = 8.0.35-1.el7,它被软件包 mysql-community-server-8.0.35-1.el7.x86_64 需要
--> 正在处理依赖关系 mysql-community-icu-data-files = 8.0.35-1.el7,它被软件包 mysql-community-server-8.0.35-1.el7.x86_64 需要
--> 正在处理依赖关系 mysql-community-client(x86-64) >= 8.0.11,它被软件包 mysql-community-server-8.0.35-1.el7.x86_64 需要
--> 正在检查事务
---> 软件包 mysql-community-client.x86_64.0.8.0.35-1.el7 将被 安装
--> 正在处理依赖关系 mysql-community-client-plugins = 8.0.35-1.el7,它被软件包 mysql-community-client-8.0.35-1.el7.x86_64 需要
--> 正在处理依赖关系 mysql-community-libs(x86-64) >= 8.0.11,它被软件包 mysql-community-client-8.0.35-1.el7.x86_64 需要
---> 软件包 mysql-community-common.x86_64.0.8.0.35-1.el7 将被 安装
---> 软件包 mysql-community-icu-data-files.x86_64.0.8.0.35-1.el7 将被 安装
--> 正在检查事务
---> 软件包 mariadb-libs.x86_64.1.5.5.68-1.el7 将被 取代
--> 正在处理依赖关系 libmysqlclient.so.18()(64bit),它被软件包 2:postfix-2.10.1-9.el7.x86_64 需要
--> 正在处理依赖关系 libmysqlclient.so.18(libmysqlclient_18)(64bit),它被软件包 2:postfix-2.10.1-9.el7.x86_64 需要
---> 软件包 mysql-community-client-plugins.x86_64.0.8.0.35-1.el7 将被 安装
---> 软件包 mysql-community-libs.x86_64.0.8.0.35-1.el7 将被 舍弃
--> 正在检查事务
---> 软件包 mysql-community-libs-compat.x86_64.0.8.0.35-1.el7 将被 舍弃
--> 解决依赖关系完成依赖关系解决===============================================================================================================================================================================================Package 架构 版本 源 大小
===============================================================================================================================================================================================
正在安装:mysql-community-libs x86_64 8.0.35-1.el7 mysql80-community 1.5 M替换 mariadb-libs.x86_64 1:5.5.68-1.el7mysql-community-libs-compat x86_64 8.0.35-1.el7 mysql80-community 669 k替换 mariadb-libs.x86_64 1:5.5.68-1.el7mysql-community-server x86_64 8.0.35-1.el7 mysql80-community 64 M
为依赖而安装:mysql-community-client x86_64 8.0.35-1.el7 mysql80-community 16 Mmysql-community-client-plugins x86_64 8.0.35-1.el7 mysql80-community 3.5 Mmysql-community-common x86_64 8.0.35-1.el7 mysql80-community 665 kmysql-community-icu-data-files x86_64 8.0.35-1.el7 mysql80-community 2.2 M事务概要
===============================================================================================================================================================================================
安装 3 软件包 (+4 依赖软件包)总下载量:89 M
Is this ok [y/d/N]: y
Downloading packages:
mysql-community-client-8.0.35- FAILED 0% [ ] 1.1 kB/s | 46 kB 23:13:17 ETA
http://repo.mysql.com/yum/mysql-8.0-community/el/7/x86_64/mysql-community-client-8.0.35-1.el7.x86_64.rpm: [Errno 12] Timeout on http://repo.mysql.com/yum/mysql-8.0-community/el/7/x86_64/mysql-community-client-8.0.35-1.el7.x86_64.rpm: (28, 'Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds')
正在尝试其它镜像。
mysql-community-client-plugins FAILED 0% [ ] 1.4 kB/s | 280 kB 18:15:11 ETA
http://repo.mysql.com/yum/mysql-8.0-community/el/7/x86_64/mysql-community-client-plugins-8.0.35-1.el7.x86_64.rpm: [Errno 12] Timeout on http://repo.mysql.com/yum/mysql-8.0-community/el/7/x86_64/mysql-community-client-plugins-8.0.35-1.el7.x86_64.rpm: (28, 'Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds')
正在尝试其它镜像。
mysql-community-common-8.0.35- FAILED 0% [ ] 2.1 B/s | 434 kB 12427:49:49 ETA
http://repo.mysql.com/yum/mysql-8.0-community/el/7/x86_64/mysql-community-common-8.0.35-1.el7.x86_64.rpm: [Errno 12] Timeout on http://repo.mysql.com/yum/mysql-8.0-community/el/7/x86_64/mysql-community-common-8.0.35-1.el7.x86_64.rpm: (28, 'Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds')
正在尝试其它镜像。
mysql-community-icu-data-files FAILED 0% [ ] 5.4 B/s | 68 kB 4752:59:45 ETA
http://repo.mysql.com/yum/mysql-8.0-community/el/7/x86_64/mysql-community-icu-data-files-8.0.35-1.el7.x86_64.rpm: [Errno 12] Timeout on http://repo.mysql.com/yum/mysql-8.0-community/el/7/x86_64/mysql-community-icu-data-files-8.0.35-1.el7.x86_64.rpm: (28, 'Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds')
正在尝试其它镜像。
mysql-community-libs-8.0.35-1. FAILED 0% [ ] 0.8 B/s | 184 kB 31857:32:53 ETA
http://repo.mysql.com/yum/mysql-8.0-community/el/7/x86_64/mysql-community-libs-8.0.35-1.el7.x86_64.rpm: [Errno 12] Timeout on http://repo.mysql.com/yum/mysql-8.0-community/el/7/x86_64/mysql-community-libs-8.0.35-1.el7.x86_64.rpm: (28, 'Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds')
正在尝试其它镜像。
mysql-community-libs-compat-8. FAILED 0% [ ] 9.6 B/s | 550 kB 2674:52:24 ETA
http://repo.mysql.com/yum/mysql-8.0-community/el/7/x86_64/mysql-community-libs-compat-8.0.35-1.el7.x86_64.rpm: [Errno 12] Timeout on http://repo.mysql.com/yum/mysql-8.0-community/el/7/x86_64/mysql-community-libs-compat-8.0.35-1.el7.x86_64.rpm: (28, 'Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds')
正在尝试其它镜像。mysql-community-server-8.0.35- FAILED
http://repo.mysql.com/yum/mysql-8.0-community/el/7/x86_64/mysql-community-server-8.0.35-1.el7.x86_64.rpm: [Errno 12] Timeout on http://repo.mysql.com/yum/mysql-8.0-community/el/7/x86_64/mysql-community-server-8.0.35-1.el7.x86_64.rpm: (28, 'Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds')
正在尝试其它镜像。
mysql-community-client-8.0.35- FAILED 0% [- ] 5.6 B/s | 804 kB 4605:51:37 ETA
http://repo.mysql.com/yum/mysql-8.0-community/el/7/x86_64/mysql-community-client-8.0.35-1.el7.x86_64.rpm: [Errno 12] Timeout on http://repo.mysql.com/yum/mysql-8.0-community/el/7/x86_64/mysql-community-client-8.0.35-1.el7.x86_64.rpm: (28, 'Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds')
正在尝试其它镜像。
警告:/var/cache/yum/x86_64/7/mysql80-community/packages/mysql-community-client-plugins-8.0.35-1.el7.x86_64.rpm: 头V4 RSA/SHA256 Signature, 密钥 ID 3a79bd29: NOKEYkB/s | 3.3 MB 00:01:59 ETA
mysql-community-client-plugins-8.0.35-1.el7.x86_64.rpm 的公钥尚未安装
(1/7): mysql-community-client-plugins-8.0.35-1.el7.x86_64.rpm | 3.5 MB 00:00:02
(2/7): mysql-community-common-8.0.35-1.el7.x86_64.rpm | 665 kB 00:00:00
(3/7): mysql-community-icu-data-files-8.0.35-1.el7.x86_64.rpm | 2.2 MB 00:00:00
(4/7): mysql-community-libs-8.0.35-1.el7.x86_64.rpm | 1.5 MB 00:00:00
(5/7): mysql-community-libs-compat-8.0.35-1.el7.x86_64.rpm | 669 kB 00:00:00
(6/7): mysql-community-server-8.0.35-1.el7.x86_64.rpm | 64 MB 00:00:10
(7/7): mysql-community-client-8.0.35-1.el7.x86_64.rpm | 16 MB 00:00:02
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
总计 71 kB/s | 89 MB 00:21:14
从 file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2023 检索密钥
导入 GPG key 0xA8D3785C:用户ID : "MySQL Release Engineering <mysql-build@oss.oracle.com>"指纹 : bca4 3417 c3b4 85dd 128e c6d4 b7b3 b788 a8d3 785c软件包 : mysql80-community-release-el7-11.noarch (@/mysql80-community-release-el7-11.noarch)来自 : /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2023
是否继续?[y/N]:从 file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2022 检索密钥
导入 GPG key 0x3A79BD29:用户ID : "MySQL Release Engineering <mysql-build@oss.oracle.com>"指纹 : 859b e8d7 c586 f538 430b 19c2 467b 942d 3a79 bd29软件包 : mysql80-community-release-el7-11.noarch (@/mysql80-community-release-el7-11.noarch)来自 : /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2022
是否继续?[y/N]:y
从 file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql 检索密钥
导入 GPG key 0x5072E1F5:用户ID : "MySQL Release Engineering <mysql-build@oss.oracle.com>"指纹 : a4a9 4068 76fc bd3c 4567 70c8 8c71 8d3b 5072 e1f5软件包 : mysql80-community-release-el7-11.noarch (@/mysql80-community-release-el7-11.noarch)来自 : /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
是否继续?[y/N]:y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction正在安装 : mysql-community-common-8.0.35-1.el7.x86_64 1/8 正在安装 : mysql-community-client-plugins-8.0.35-1.el7.x86_64 2/8 正在安装 : mysql-community-libs-8.0.35-1.el7.x86_64 3/8 正在安装 : mysql-community-client-8.0.35-1.el7.x86_64 4/8 正在安装 : mysql-community-icu-data-files-8.0.35-1.el7.x86_64 5/8 正在安装 : mysql-community-server-8.0.35-1.el7.x86_64 6/8
warning: /etc/my.cnf created as /etc/my.cnf.rpmnew正在安装 : mysql-community-libs-compat-8.0.35-1.el7.x86_64 7/8 正在删除 : 1:mariadb-libs-5.5.68-1.el7.x86_64 8/8 验证中 : mysql-community-client-plugins-8.0.35-1.el7.x86_64 1/8 验证中 : mysql-community-common-8.0.35-1.el7.x86_64 2/8 验证中 : mysql-community-icu-data-files-8.0.35-1.el7.x86_64 3/8 验证中 : mysql-community-libs-8.0.35-1.el7.x86_64 4/8 验证中 : mysql-community-client-8.0.35-1.el7.x86_64 5/8 验证中 : mysql-community-libs-compat-8.0.35-1.el7.x86_64 6/8 验证中 : mysql-community-server-8.0.35-1.el7.x86_64 7/8 验证中 : 1:mariadb-libs-5.5.68-1.el7.x86_64 8/8 已安装:mysql-community-libs.x86_64 0:8.0.35-1.el7 mysql-community-libs-compat.x86_64 0:8.0.35-1.el7 mysql-community-server.x86_64 0:8.0.35-1.el7 作为依赖被安装:mysql-community-client.x86_64 0:8.0.35-1.el7 mysql-community-client-plugins.x86_64 0:8.0.35-1.el7 mysql-community-common.x86_64 0:8.0.35-1.el7 mysql-community-icu-data-files.x86_64 0:8.0.35-1.el7 替代:mariadb-libs.x86_64 1:5.5.68-1.el7 完毕!
[root@szaliyun ~]#
可以看到安装并不顺利,程序自动更换镜像后安装最终完成。
四、启动mysql服务
[root@szaliyun ~]# systemctl status mysqld
启动失败,查日志
[root@szaliyun ~]# journalctl -xe | grep mysql
查到说redo log格式不对
10月 26 07:14:54 szaliyun mysqld[19819]: 2023-10-25T23:14:53.988237Z 1 [ERROR] [MY-013090] [InnoDB] Unsupported redo log format (v0). The redo log was created before MySQL 5.7.9
按网上查了一下,说是需要将ib_logfile0和ib_logfile1移走
于是查找并移走这两个文件,重启依旧报错,说找不到目录
Neither found #innodb_redo subdirectory, nor ib_logfile* files in /www/server/data/
尝试了网上说的一些方法,也解决不了,估计是mysql5.7版本没卸载导致8.0不能正常运行。
实在没办法就卸载重装吧:
[root@szaliyun ~]# rpm -qa | grep -i mysql
bt-mysql56-5.6.50-1.el7.x86_64
mysql-community-libs-8.0.35-1.el7.x86_64
mysql-community-libs-compat-8.0.35-1.el7.x86_64
mysql-community-client-plugins-8.0.35-1.el7.x86_64
mysql-community-client-8.0.35-1.el7.x86_64
mysql-community-server-8.0.35-1.el7.x86_64
mysql80-community-release-el7-11.noarch
mysql-community-common-8.0.35-1.el7.x86_64
mysql-community-icu-data-files-8.0.35-1.el7.x86_64
[root@szaliyun ~]#
[root@szaliyun ~]# yum remove bt-mysql56-5.6.50-1.el7.x86_64
[root@szaliyun ~]# yum remove mysql-community-server-8.0.35-1.el7.x86_64
[root@szaliyun ~]# yum install mysql-community-server
启动mysql,继续报错:
[root@szaliyun ~]# cat /var/log/mysqld.log
2023-10-29T08:28:10.584709Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.0.35) initializing of server in progress as process 21123
2023-10-29T08:28:10.589908Z 0 [ERROR] [MY-010457] [Server] --initialize specified but the data directory has files in it. Aborting.
2023-10-29T08:28:10.589953Z 0 [ERROR] [MY-013236] [Server] The designated data directory /var/lib/mysql/ is unusable. You can remove all files that the server added to it.
2023-10-29T08:28:10.590006Z 0 [ERROR] [MY-010119] [Server] Aborting
关键是这一条:2023-10-29T08:28:10.589953Z 0 [ERROR] [MY-013236] [Server] The designated data directory /var/lib/mysql/ is unusable. You can remove all files that the server added to it.
大概是说指定的这个目录不可用,你可以删除所有这些文件。做好备份后删掉重新启动。
[root@szaliyun lib]# cp -r mysql/ mysql231029back
[root@szaliyun lib]# cd mysql
[root@szaliyun mysql]# ls
auto.cnf binlog.index ca-key.pem ca.pem client-cert.pem client-key.pem #innodb_redo mysql-bin private_key.pem public_key.pem server-cert.pem server-key.pem
[root@szaliyun mysql]# rm -rf /var/lib/mysql/*
[root@szaliyun mysql]# ls
[root@szaliyun mysql]# systemctl start mysql
Failed to start mysql.service: Unit not found.
[root@szaliyun mysql]# systemctl start mysqld
[root@szaliyun mysql]#
[root@szaliyun mysql]# systemctl status mysqld
● mysqld.service - MySQL ServerLoaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)Active: active (running) since 日 2023-10-29 16:46:32 CST; 6s agoDocs: man:mysqld(8)http://dev.mysql.com/doc/refman/en/using-systemd.htmlProcess: 11202 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)Main PID: 11369 (mysqld)Status: "Server is operational"CGroup: /system.slice/mysqld.service└─11369 /usr/sbin/mysqld10月 29 16:46:26 szaliyun systemd[1]: Starting MySQL Server...
10月 29 16:46:32 szaliyun systemd[1]: Started MySQL Server.
[root@szaliyun mysql]#
启动成功!
五、获取并修改密码
获取临时密码
[root@szaliyun mysql]# grep 'temporary password' /var/log/mysqld.log
2023-10-29T08:46:29.090680Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: giAufyacf3</
[root@szaliyun mysql]#
然后尝试登录
[root@szaliyun /]# mysql -u root -p
-bash: mysql: 未找到命令
[root@szaliyun mysql]# which mysql
/usr/bin/which: no mysql in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin)
[root@szaliyun mysql]#
没有找到mysql,经过几番测试,还是没找到mysql的安装目录,最后GPT让我重装。
[root@szaliyun mysql]# rpm -qa | grep mysql
mysql-community-libs-8.0.35-1.el7.x86_64
mysql-community-libs-compat-8.0.35-1.el7.x86_64
mysql-community-server-8.0.35-1.el7.x86_64
mysql-community-client-plugins-8.0.35-1.el7.x86_64
mysql-community-client-8.0.35-1.el7.x86_64
mysql80-community-release-el7-11.noarch
mysql-community-common-8.0.35-1.el7.x86_64
mysql-community-icu-data-files-8.0.35-1.el7.x86_64
[root@szaliyun mysql]# yum reinstall mysql-community-client-8.0.35-1.el7.x86_64
重装完之后就可以了
[root@szaliyun mysql]# which mysql
/usr/bin/mysql
然后就是修改密码:
[root@szaliyun /]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 8.0.35Copyright (c) 2000, 2023, Oracle and/or its affiliates.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>
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'New%Password4';
Query OK, 0 rows affected (0.15 sec)mysql>
至此修改密码完成。
六、防火墙放行、远程登录和设置
放开CentOS网络端口
[root@szaliyun ~]# firewall-cmd --zone=public --add-port=3306/tcp --permanent
[root@szaliyun ~]# firewall-cmd --reload
然后再在硬件防火墙上放开(如果需要),如果是使用云服务器(例如阿里云),则在云供应商的设置页面放开3306端口。
然后在公网上telnet ip 3306,端口通了。
再使用SQLyog尝试连接数据库,显示 :
出现这个Host is not allowed to connect to this MySQL server很常见,就是我现在要连接的ip没有授权访问,授权就好。
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 -ADatabase changed
mysql> update user set host = '%' where user = 'root';
Query OK, 1 row affected (0.02 sec)
Rows matched: 1 Changed: 1 Warnings: 0mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.01 sec)mysql>
继续测试连接,报下面错误:
Plugin caching_sha2_password could not be loaded报错
这是因为MYSQL8.0版使用了新的密码机制。
为了方便,将密码机制改为mysql_native_password(安全性降低了)
mysql> select Host,User,Plugin from mysql.user;
+-----------+------------------+-----------------------+
| Host | User | Plugin |
+-----------+------------------+-----------------------+
| % | root | caching_sha2_password |
| localhost | mysql.infoschema | caching_sha2_password |
| localhost | mysql.session | caching_sha2_password |
| localhost | mysql.sys | caching_sha2_password |
+-----------+------------------+-----------------------+
4 rows in set (0.00 sec)mysql> alter user root@'%' identified with mysql_native_password by 'New#password2';
Query OK, 0 rows affected (0.00 sec)mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)mysql> select Host,User,Plugin from mysql.user;
+-----------+------------------+-----------------------+
| Host | User | Plugin |
+-----------+------------------+-----------------------+
| % | root | mysql_native_password |
| localhost | mysql.infoschema | caching_sha2_password |
| localhost | mysql.session | caching_sha2_password |
| localhost | mysql.sys | caching_sha2_password |
+-----------+------------------+-----------------------+
4 rows in set (0.00 sec)mysql>
再测试连接,成功!
七、命令记录
过程中敲过的一些命令:
#安装MYSQL8的yum源
[root@szaliyun ~]# yum localinstall https://repo.mysql.com//mysql80-community-release-el7-11.noarch.rpm
[root@szaliyun ~]# yum repolist enabled
[root@szaliyun ~]# yum repolist enabled | grep "mysql.*-community.*"
[root@szaliyun ~]# find / -name ib_logfile0 #查找文件
[root@szaliyun data]# mkdir ib_logfilebackup
[root@szaliyun data]# cp ib_logfile0 ib_logfilebackup/
#卸载mysql5.6
[root@szaliyun ~]# yum remove bt-mysql56-5.6.50-1.el7.x86_64
#卸载mysql-community-server
[root@szaliyun ~]# yum remove mysql-community-server-8.0.35-1.el7.x86_64
[root@szaliyun ~]# yum install mysql-community-server
[root@szaliyun ~]# systemctl start mysqld
[root@szaliyun ~]# systemctl status mysqld
[root@szaliyun ~]# cat /var/log/mysqld.log
[root@szaliyun ~]# which mysql
#重装mysql客户端
[root@szaliyun mysql]# yum reinstall mysql-community-client-8.0.35-1.el7.x86_64
[root@szaliyun ~]# firewall-cmd --zone=public --add-port=3306/tcp --permanent
[root@szaliyun ~]# firewall-cmd --reload
[root@szaliyun /]# mysql -u root -p
#修改密码
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'New%Password4';
#放开所有地址访问数据库
mysql> update user set host = '%' where user = 'root';
#修改密码规则
mysql> alter user root@'%' identified with mysql_native_password by 'New#password2';
相关文章:

在CentOS上用yum方式安装MySQL8过程记录
此文参考官方文档一步一步记录安装到正常运行全过程 安装环境:centos7 mysql版本:8.0.35 安装过程主要参考下面两边文章: 1.官方文档 https://dev.mysql.com/doc/refman/8.0/en/linux-installation-yum-repo.html 2.linux yum安装mysql8 安…...

CEYEE希亦新品洗地机Pro系列发布, 领跑行业的「水汽混动」技术的旗舰新杰作
CEYEE希亦全新一代洗地机T800 PRO正式上市,采用双滚刷,双倍活水洗拖洗方式,达到拖一遍抵两遍,相对于10倍洁净效果! 这款希亦Pro系列产品不仅刷新了洗地机行业技术水准,满足了用户愈发极致的清洁效能追求&a…...

为什么要安装防静电门禁闸机
安装防静电门禁闸机可以带来以下几个方面的好处: 防止静电干扰:静电是一种非常危险的物理现象,它可以对电子元器件、电路板和其他敏感设备造成损害,甚至导致设备故障和生产中断。防静电门禁闸机可以有效地防止静电的产生和传导&am…...

[linux] shell中的()和{}
参考:https://www.cnblogs.com/cheer-lingmu/p/16467561.html 参考:shell中各种括号的作用详解()、(())、[]、[[]]、{}(推荐)_linux shell_脚本之家 一、小括号() 1、命令替换:等同于cmd,shell扫描一遍命令行,发现了…...

jdk官网下载(详细步骤)
jdk全部版本下载网址 Java Archive | Oraclehttps://www.oracle.com/java/technologies/downloads/archive/ 下载之前先建立oracle账号(免费创建),不用特意去搜,你点击下载jdk的时候会自动弹出来,自己建立一个账号就能下载了 找到自己要下载…...

10.24 校招 实习 内推 面经
绿*泡*泡: neituijunsir 交流裙 ,内推/实习/校招汇总表格 1、校招 | 吉利控股集团2024届全球校园招聘路特斯科技专场(内推) 校招 | 吉利控股集团2024届全球校园招聘路特斯科技专场(内推) 2、数字IC验证…...

Pico Neo4、Neo3开发手柄的使用交互监听
using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.XR;public class InputEvent : MonoSingleton<InputEvent> {//*************输入设别**************************InputDevice leftHandController;Inp…...

【k8s】pod详解
一、Pod介绍 1、Pod的基础概念 Pod是kubernetes中最小的资源管理组件,Pod也是最小化运行容器化应用的资源对象,一个pod代表着集群中运行的一个进程。kubernetes中其它大多数组件都是围绕着pod来进行支持和扩展pod功能的。 例如,用于管理po…...

优思学院:质量管理7原则、8大要点
在质量管理的道路上,没有捷径可循。质量管理是一项需要不断积累经验和智慧的长期过程,其中涵盖了七大关键原则,这些原则是组织在质量管理方面取得持续成功的基石。 1. 以顾客为关注焦点 释义: 质量管理的核心在于满足顾客需求&am…...

自动化测试如何解析excel文件?
前言 自动化测试中我们存放数据无非是使用文件或者数据库,那么文件可以是csv,xlsx,xml,甚至是txt文件,通常excel文件往往是我们的首选,无论是编写测试用例还是存放测试数据,excel都是很方便的。…...

职场好物:乐歌M9S升降办公电脑台,告别久坐办公,升职加薪就选它
办公是现代生活不可避免的组成部分,科技的快速发展,给了我们更多新的生活方式,促使我们更加关注自己的身体状况,我们挨过了饭都吃不饱的年代,随着办公人群的不断扩张,不知道你有没有发现身边人或多或少都有…...

springboot+vue基于Hadoop短视频流量数据分析与可视化系统的设计与实现【内含源码+文档+部署教程】
博主介绍:✌全网粉丝10W,前互联网大厂软件研发、集结硕博英豪成立工作室。专注于计算机相关专业毕业设计项目实战6年之久,选择我们就是选择放心、选择安心毕业✌ 🍅由于篇幅限制,想要获取完整文章或者源码,或者代做&am…...

审核 Microsoft SQL Server 日志
手动审核数据库活动是一项艰巨的任务,有效完成审计的最佳方法是使用简化和自动化数据库监控的综合解决方案,该解决方案还应使数据库管理员能够监控、跟踪和即时识别任何操作问题的根本原因,并实时检测对机密数据的未经授权的访问。 什么是 S…...

【NLP】什么是语义搜索以及如何实现 [Python、BERT、Elasticsearch]
语义搜索是一种先进的信息检索技术,旨在通过理解搜索查询和搜索内容的上下文和含义来提高搜索结果的准确性和相关性。与依赖于匹配特定单词或短语的传统基于关键字的搜索不同,语义搜索会考虑查询的意图、上下文和语义。 语义搜索在搜索结果的精度和相关…...

【JavaScript】JS基础语法
1 JavaScript 的书写形式 1.1 行内式 直接嵌入到 html 元素内部 <input type"button" value"按钮" onclick"alert(hello JavaScript)" >1.2 内嵌式 写在script标签内 <script>alert("haha")</script>1.3 外部式…...

06-云计算概览及问题关注
容器生态系统 容器生态系统包含核心技术、平台技术和支持技术。 1-1 容器核心技术 其中容器核心技术指的是能让容器在主机服务器上运行的技术,包含容器规范、容器 runtime、容器管理工具、容器生态工具、registries、容器 OS。 容器规范: 容器除了常…...

怎么监控钉钉聊天记录内容(监控钉钉聊天记录的3种形式)
企业沟通工具的普及,越来越多的企业开始使用钉钉作为内部沟通工具。然而,对于企业管理者来说,如何监控钉钉聊天记录内容成为了一个重要的问题。本文将介绍几种方法,帮助企业管理者实现监控钉钉聊天记录内容的目的。 一、钉钉自带功…...

深入理解强化学习——强化学习的历史:时序差分学习
分类目录:《深入理解强化学习》总目录 相关文章: 强化学习的历史:最优控制 强化学习的历史:试错学习 强化学习的历史:试错学习的发展 强化学习的历史:K臂赌博机、统计学习理论和自适应系统 强化学习的…...

OpenCloudOS9操作系统搭建Confluence8.0.4企业WIKI
OpenCloudOS9操作系统搭建Confluence8.0.4企业WIKI 1. 概要2. 系统基础环境配置3. 安装并配置MySQL3.1. 安装MySQL3.2. MySQL基本配置3.3. 创建Confluence数据库4. 安装并配置Confluence5. 破解Confluence6. 优化配置Confluence7. confluence对接Windows AD域环境1. 概要 Atlas…...

03-Vue中的常用指令的使用,事件及其修饰符
常用指令 指令语法和插值语法 Vue框架中的所有指令的名字都以v-开始,完整语法格式<HTML标签 v-指令名:参数"javascript表达式(表达式的结果是一个值)"></HTML标签>: 指令的职责是当表达式的值改变时,将其产生的连带影响,响应式地作用于DOM元素不是所有…...

ScrapeKit库中Swift爬虫程序写一段代码
以下是一个使用ScrapeKit库的Swift爬虫程序,用于爬取网页视频的代码: import ScrapeKit// 创建一个配置对象,用于指定爬虫ip服务器信息 let config Configuration(proxyHost: "duoip", proxyPort: 8000)// 创建一个爬虫对象 let s…...

总感觉戴助听器耳朵又闷又堵怎么办?
随着助听器技术的进步发展,这些问题都有了一定程度的改善。例如,现在的助听器变得越来越小巧,外形更加美观和隐蔽;各种降噪技术和验配技巧也提升了助听器的音质和清晰度。 但是,还有一个问题困扰着很多助听器用户&…...

编程助手DevChat:让开发更轻松
#AI编程助手哪家好?DevChat“真”好用 # 目录 前言一、安装Vscode1、下载链接2、安装 二、注册DevChat1、打开注册页2、验证成功完成邮箱绑定3、绑定微信可获得8元 三、安装插件四、配置Access Key1、获取Access Key2、设置Access Key①、点击左下角管理(…...

稳定扩散的高分辨率图像合成
推荐稳定扩散AI自动纹理工具:DreamTexture.js自动纹理化开发包 1、稳定扩散介绍 通过将图像形成过程分解为去噪自动编码器的顺序应用,扩散模型 (DM) 在图像数据及其他数据上实现了最先进的合成结果。此外,它们的配方…...

3 Tensorflow构建模型详解
上一篇:2 用TensorFlow构建一个简单的神经网络-CSDN博客 本篇目标是介绍如何构建一个简单的线性回归模型,要点如下: 了解神经网络原理构建模型的一般步骤模型重要参数介绍 1、神经网络概念 接上一篇,用tensorflow写了一个猜测西…...

智慧农场牧场小程序源码 智慧农业认养系统源码
智慧农场牧场小程序源码 智慧农业认养系统源码 要了解源码的,看文末。 随着科技的进步和人们对绿色食品的需求增加,智慧农场正成为未来农业发展的方向。智慧农场是指运用先进的技术手段,如物联网、云计算、智能控制技术、大数据分析等&…...

3D数据过滤为2D数据集并渲染
开发环境: Windows 11 家庭中文版Microsoft Visual Studio Community 2019VTK-9.3.0.rc0vtk-example参考代码 代码逻辑:初始化数据集points -> 添加数据集到polydata -> 通过vtkVertexGlyphFilter过滤(带顶点、单元数据)po…...

第十一章 ObjectScript 系统宏(二)
文章目录 第十一章 ObjectScript 系统宏(二) 宏引用FormatText(text, arg1, arg2, ...)FormatTextHTML(text, arg1, arg2, ...)FormatTextJS(text, arg1, arg2, ...)GETERRORCODE(sc)GETERRORMESSAGE(sc,num)ISERR(sc)ISOK(sc)Text(text, domain, langua…...

跨境电商大作战:2023黑色星期五准备指南
黑色星期五,作为全球购物狂欢的象征,已经成为了电商业务的一年一度的重要节点。尤其对于跨境电商来说,这一天意味着巨大的商机和挑战。为了在这个竞争激烈的时刻脱颖而出,跨境电商必须做好充分的准备。Nox聚星在这里给大家分享几个…...

我的天!阿里云服务器居然比腾讯云优惠1元!
2023阿里云服务器优惠活动来了,以前一直是腾讯云比阿里云优惠,阿里云绝地反击,放开老用户购买资格,99元服务器老用户可以买,并且享受99元续费,阿腾云亲测可行,大家抓紧吧,数量不多&a…...