前言
MySQL 8.4 是一个长期支持版本(LTS),专注于提升性能、增强安全性、丰富的功能扩展和提供更多高级特性。它在InnoDB 存储引擎、复制功能、线程池、组复制、JSON 功能和性能模式等方面都有显著改进。LTS(Long-Term Support)版本在数据库领域具有重要意义,尤其适用于那些对系统稳定性和长期支持有较高要求的企业和组织。以下是LTS版本的重要性和适用场景:
- 长期支持 :LTS版本通常会提供长达五年的技术支持和安全更新,确保用户在较长的时间内无需频繁升级,减少了维护成本和风险。
- 稳定性 :LTS版本经过了广泛的测试和验证,具有更高的稳定性和可靠性。这对于关键业务系统尤为重要,可以避免因软件问题导致的服务中断和数据丢失。
- 企业级应用 :对于大型企业和金融机构等需要高度可靠性的应用场景,LTS版本是最佳选择。这些机构通常对系统的稳定性和安全性有严格要求,LTS版本能够满足他们的需求。
- 开发和测试环境 :在开发和测试环境中,使用LTS版本可以确保开发团队在一个稳定的平台上进行工作,减少因版本不一致带来的问题。
Oracle 于2025-07-22发布了最新长期支持版本 MySQL8.4.6 LTS ,对比 MySQL8.0 带来了很多新的功能也删除了(或弃用)很多旧功能。比如,从 MySQL 8.4.0 开始,已弃用的 mysql_native_password
身份验证插件不再默认启用。要启用它,请使用以下命令启动服务器 --mysql-native-password=ON
(MySQL 8.4.0 新增),或将其添加 mysql_native_password=ON
到 [mysqld]
MySQL 配置文件的相应部分,详情可以参考自 MySQL 8.0 以来 MySQL 8.4 中的新功能
RPM 安装 MySQL
下载 rpm 软件包,下载地址 MySQL Community Downloads,我们选择下载整包,就不单独下载了
解压软件包
[root@kubecc ~]# wget https://cdn.mysql.com//Downloads/MySQL-8.4/mysql-8.4.6-1.el9.x86_64.rpm-bundle.tar
--2025-08-05 10:45:12-- https://cdn.mysql.com//Downloads/MySQL-8.4/mysql-8.4.6-1.el9.x86_64.rpm-bundle.tar
Resolving cdn.mysql.com (cdn.mysql.com)... 23.202.138.125, 2600:1413:5000:98f::1d68, 2600:1413:5000:988::1d68
Connecting to cdn.mysql.com (cdn.mysql.com)|23.202.138.125|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 951019520 (907M) [application/x-tar]
Saving to: ‘mysql-8.4.6-1.el9.x86_64.rpm-bundle.tar’
mysql-8.4.6-1.el9.x86_64.rpm-bund 100%[============================================================>] 906.96M 41.7MB/s in 22s
2025-08-05 10:45:34 (42.1 MB/s) - ‘mysql-8.4.6-1.el9.x86_64.rpm-bundle.tar’ saved [951019520/951019520]
[root@kubecc ~]# tar -xvf mysql-8.4.6-1.el9.x86_64.rpm-bundle.tar
mysql-community-client-8.4.6-1.el9.x86_64.rpm
mysql-community-client-debuginfo-8.4.6-1.el9.x86_64.rpm
mysql-community-client-plugins-8.4.6-1.el9.x86_64.rpm
mysql-community-client-plugins-debuginfo-8.4.6-1.el9.x86_64.rpm
mysql-community-common-8.4.6-1.el9.x86_64.rpm
mysql-community-debuginfo-8.4.6-1.el9.x86_64.rpm
mysql-community-debugsource-8.4.6-1.el9.x86_64.rpm
mysql-community-devel-8.4.6-1.el9.x86_64.rpm
mysql-community-icu-data-files-8.4.6-1.el9.x86_64.rpm
mysql-community-libs-8.4.6-1.el9.x86_64.rpm
mysql-community-libs-compat-8.4.6-1.el9.x86_64.rpm
mysql-community-libs-compat-debuginfo-8.4.6-1.el9.x86_64.rpm
mysql-community-libs-debuginfo-8.4.6-1.el9.x86_64.rpm
mysql-community-server-8.4.6-1.el9.x86_64.rpm
mysql-community-server-debug-8.4.6-1.el9.x86_64.rpm
mysql-community-server-debug-debuginfo-8.4.6-1.el9.x86_64.rpm
mysql-community-server-debuginfo-8.4.6-1.el9.x86_64.rpm
mysql-community-test-8.4.6-1.el9.x86_64.rpm
mysql-community-test-debuginfo-8.4.6-1.el9.x86_64.rpm
使用 rpm 包进行安装
安装过程中会自动处理相关依赖问题
[root@kubecc ~]# dnf install mysql*.rpm
Rocky Linux 9 - BaseOS 34 kB/s | 4.1 kB 00:00
Rocky Linux 9 - AppStream 38 kB/s | 4.5 kB 00:00
Rocky Linux 9 - CRB 44 kB/s | 4.5 kB 00:00
Rocky Linux 9 - Extras 29 kB/s | 2.9 kB 00:00
Dependencies resolved.
=======================================================================================================================================
Package Architecture Version Repository Size
=======================================================================================================================================
Installing:
mysql-community-client x86_64 8.4.6-1.el9 @commandline 3.1 M
mysql-community-client-debuginfo x86_64 8.4.6-1.el9 @commandline 26 M
mysql-community-client-plugins x86_64 8.4.6-1.el9 @commandline 1.5 M
mysql-community-client-plugins-debuginfo x86_64 8.4.6-1.el9 @commandline 3.1 M
mysql-community-common x86_64 8.4.6-1.el9 @commandline 578 k
mysql-community-debuginfo x86_64 8.4.6-1.el9 @commandline 5.4 M
mysql-community-debugsource x86_64 8.4.6-1.el9 @commandline 17 M
mysql-community-devel x86_64 8.4.6-1.el9 @commandline 7.5 M
mysql-community-icu-data-files x86_64 8.4.6-1.el9 @commandline 2.3 M
mysql-community-libs x86_64 8.4.6-1.el9 @commandline 1.5 M
mysql-community-libs-compat x86_64 8.4.6-1.el9 @commandline 1.4 M
mysql-community-libs-compat-debuginfo x86_64 8.4.6-1.el9 @commandline 2.5 M
mysql-community-libs-debuginfo x86_64 8.4.6-1.el9 @commandline 2.7 M
mysql-community-server x86_64 8.4.6-1.el9 @commandline 50 M
mysql-community-server-debug x86_64 8.4.6-1.el9 @commandline 24 M
mysql-community-server-debug-debuginfo x86_64 8.4.6-1.el9 @commandline 156 M
mysql-community-server-debuginfo x86_64 8.4.6-1.el9 @commandline 197 M
mysql-community-test x86_64 8.4.6-1.el9 @commandline 382 M
mysql-community-test-debuginfo x86_64 8.4.6-1.el9 @commandline 23 M
Installing dependencies:
openssl-devel x86_64 1:3.2.2-6.el9_5.1 appstream 3.2 M
perl-English noarch 1.11-481.1.el9_6 appstream 12 k
perl-File-Copy noarch 2.34-481.1.el9_6 appstream 19 k
perl-File-Find noarch 1.37-481.1.el9_6 appstream 24 k
perl-JSON noarch 4.03-5.el9 appstream 95 k
perl-Math-BigInt noarch 1:1.9998.18-460.el9 appstream 188 k
perl-Math-Complex noarch 1.59-481.1.el9_6 appstream 45 k
perl-Memoize noarch 1.03-481.1.el9_6 appstream 55 k
perl-Sys-Hostname x86_64 1.23-481.1.el9_6 appstream 15 k
perl-Time noarch 1.03-481.1.el9_6 appstream 17 k
perl-Time-HiRes x86_64 4:1.9764-462.el9 appstream 57 k
Transaction Summary
=======================================================================================================================================
Install 30 Packages
Total size: 911 M
Total download size: 3.7 M
Installed size: 3.4 G
Is this ok [y/N]: y
Downloading Packages:
(1/11): perl-Time-1.03-481.1.el9_6.noarch.rpm 110 kB/s | 17 kB 00:00
(2/11): perl-Memoize-1.03-481.1.el9_6.noarch.rpm 347 kB/s | 55 kB 00:00
(3/11): perl-File-Copy-2.34-481.1.el9_6.noarch.rpm 171 kB/s | 19 kB 00:00
(4/11): perl-JSON-4.03-5.el9.noarch.rpm 458 kB/s | 95 kB 00:00
(5/11): perl-File-Find-1.37-481.1.el9_6.noarch.rpm 235 kB/s | 24 kB 00:00
(6/11): perl-Sys-Hostname-1.23-481.1.el9_6.x86_64.rpm 127 kB/s | 15 kB 00:00
(7/11): perl-Time-HiRes-1.9764-462.el9.x86_64.rpm 386 kB/s | 57 kB 00:00
(8/11): perl-Math-Complex-1.59-481.1.el9_6.noarch.rpm 643 kB/s | 45 kB 00:00
(9/11): openssl-devel-3.2.2-6.el9_5.1.x86_64.rpm 5.5 MB/s | 3.2 MB 00:00
(10/11): perl-Math-BigInt-1.9998.18-460.el9.noarch.rpm 1.0 MB/s | 188 kB 00:00
(11/11): perl-English-1.11-481.1.el9_6.noarch.rpm 89 kB/s | 12 kB 00:00
---------------------------------------------------------------------------------------------------------------------------------------
Total 5.3 MB/s | 3.7 MB 00:00
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : mysql-community-debugsource-8.4.6-1.el9.x86_64 1/30
Installing : mysql-community-debuginfo-8.4.6-1.el9.x86_64 2/30
Installing : mysql-community-common-8.4.6-1.el9.x86_64 3/30
Installing : mysql-community-client-plugins-8.4.6-1.el9.x86_64 4/30
Installing : mysql-community-libs-8.4.6-1.el9.x86_64 5/30
Running scriptlet: mysql-community-libs-8.4.6-1.el9.x86_64 5/30
Installing : mysql-community-client-8.4.6-1.el9.x86_64 6/30
Installing : mysql-community-icu-data-files-8.4.6-1.el9.x86_64 7/30
Running scriptlet: mysql-community-server-8.4.6-1.el9.x86_64 8/30
Installing : mysql-community-server-8.4.6-1.el9.x86_64 8/30
Running scriptlet: mysql-community-server-8.4.6-1.el9.x86_64 8/30
Installing : perl-English-1.11-481.1.el9_6.noarch 9/30
Installing : perl-Math-Complex-1.59-481.1.el9_6.noarch 10/30
Installing : perl-Math-BigInt-1:1.9998.18-460.el9.noarch 11/30
Installing : perl-JSON-4.03-5.el9.noarch 12/30
Installing : perl-Time-HiRes-4:1.9764-462.el9.x86_64 13/30
Installing : perl-Sys-Hostname-1.23-481.1.el9_6.x86_64 14/30
Installing : perl-File-Find-1.37-481.1.el9_6.noarch 15/30
Installing : perl-File-Copy-2.34-481.1.el9_6.noarch 16/30
Installing : perl-Memoize-1.03-481.1.el9_6.noarch 17/30
Installing : perl-Time-1.03-481.1.el9_6.noarch 18/30
Installing : openssl-devel-1:3.2.2-6.el9_5.1.x86_64 19/30
Installing : mysql-community-devel-8.4.6-1.el9.x86_64 20/30
Installing : mysql-community-test-8.4.6-1.el9.x86_64 21/30
Installing : mysql-community-server-debug-8.4.6-1.el9.x86_64 22/30
Installing : mysql-community-libs-compat-8.4.6-1.el9.x86_64 23/30
Running scriptlet: mysql-community-libs-compat-8.4.6-1.el9.x86_64 23/30
Installing : mysql-community-client-debuginfo-8.4.6-1.el9.x86_64 24/30
Installing : mysql-community-client-plugins-debuginfo-8.4.6-1.el9.x86_64 25/30
Installing : mysql-community-libs-compat-debuginfo-8.4.6-1.el9.x86_64 26/30
Installing : mysql-community-libs-debuginfo-8.4.6-1.el9.x86_64 27/30
Installing : mysql-community-server-debug-debuginfo-8.4.6-1.el9.x86_64 28/30
Installing : mysql-community-server-debuginfo-8.4.6-1.el9.x86_64 29/30
Installing : mysql-community-test-debuginfo-8.4.6-1.el9.x86_64 30/30
Running scriptlet: mysql-community-test-debuginfo-8.4.6-1.el9.x86_64 30/30
Verifying : openssl-devel-1:3.2.2-6.el9_5.1.x86_64 1/30
Verifying : perl-Time-1.03-481.1.el9_6.noarch 2/30
Verifying : perl-Memoize-1.03-481.1.el9_6.noarch 3/30
Verifying : perl-File-Copy-2.34-481.1.el9_6.noarch 4/30
Verifying : perl-JSON-4.03-5.el9.noarch 5/30
Verifying : perl-File-Find-1.37-481.1.el9_6.noarch 6/30
Verifying : perl-Sys-Hostname-1.23-481.1.el9_6.x86_64 7/30
Verifying : perl-Time-HiRes-4:1.9764-462.el9.x86_64 8/30
Verifying : perl-Math-Complex-1.59-481.1.el9_6.noarch 9/30
Verifying : perl-Math-BigInt-1:1.9998.18-460.el9.noarch 10/30
Verifying : perl-English-1.11-481.1.el9_6.noarch 11/30
Verifying : mysql-community-client-8.4.6-1.el9.x86_64 12/30
Verifying : mysql-community-client-debuginfo-8.4.6-1.el9.x86_64 13/30
Verifying : mysql-community-client-plugins-8.4.6-1.el9.x86_64 14/30
Verifying : mysql-community-client-plugins-debuginfo-8.4.6-1.el9.x86_64 15/30
Verifying : mysql-community-common-8.4.6-1.el9.x86_64 16/30
Verifying : mysql-community-debuginfo-8.4.6-1.el9.x86_64 17/30
Verifying : mysql-community-debugsource-8.4.6-1.el9.x86_64 18/30
Verifying : mysql-community-devel-8.4.6-1.el9.x86_64 19/30
Verifying : mysql-community-icu-data-files-8.4.6-1.el9.x86_64 20/30
Verifying : mysql-community-libs-8.4.6-1.el9.x86_64 21/30
Verifying : mysql-community-libs-compat-8.4.6-1.el9.x86_64 22/30
Verifying : mysql-community-libs-compat-debuginfo-8.4.6-1.el9.x86_64 23/30
Verifying : mysql-community-libs-debuginfo-8.4.6-1.el9.x86_64 24/30
Verifying : mysql-community-server-8.4.6-1.el9.x86_64 25/30
Verifying : mysql-community-server-debug-8.4.6-1.el9.x86_64 26/30
Verifying : mysql-community-server-debug-debuginfo-8.4.6-1.el9.x86_64 27/30
Verifying : mysql-community-server-debuginfo-8.4.6-1.el9.x86_64 28/30
Verifying : mysql-community-test-8.4.6-1.el9.x86_64 29/30
Verifying : mysql-community-test-debuginfo-8.4.6-1.el9.x86_64 30/30
Installed:
mysql-community-client-8.4.6-1.el9.x86_64 mysql-community-client-debuginfo-8.4.6-1.el9.x86_64
mysql-community-client-plugins-8.4.6-1.el9.x86_64 mysql-community-client-plugins-debuginfo-8.4.6-1.el9.x86_64
mysql-community-common-8.4.6-1.el9.x86_64 mysql-community-debuginfo-8.4.6-1.el9.x86_64
mysql-community-debugsource-8.4.6-1.el9.x86_64 mysql-community-devel-8.4.6-1.el9.x86_64
mysql-community-icu-data-files-8.4.6-1.el9.x86_64 mysql-community-libs-8.4.6-1.el9.x86_64
mysql-community-libs-compat-8.4.6-1.el9.x86_64 mysql-community-libs-compat-debuginfo-8.4.6-1.el9.x86_64
mysql-community-libs-debuginfo-8.4.6-1.el9.x86_64 mysql-community-server-8.4.6-1.el9.x86_64
mysql-community-server-debug-8.4.6-1.el9.x86_64 mysql-community-server-debug-debuginfo-8.4.6-1.el9.x86_64
mysql-community-server-debuginfo-8.4.6-1.el9.x86_64 mysql-community-test-8.4.6-1.el9.x86_64
mysql-community-test-debuginfo-8.4.6-1.el9.x86_64 openssl-devel-1:3.2.2-6.el9_5.1.x86_64
perl-English-1.11-481.1.el9_6.noarch perl-File-Copy-2.34-481.1.el9_6.noarch
perl-File-Find-1.37-481.1.el9_6.noarch perl-JSON-4.03-5.el9.noarch
perl-Math-BigInt-1:1.9998.18-460.el9.noarch perl-Math-Complex-1.59-481.1.el9_6.noarch
perl-Memoize-1.03-481.1.el9_6.noarch perl-Sys-Hostname-1.23-481.1.el9_6.x86_64
perl-Time-1.03-481.1.el9_6.noarch perl-Time-HiRes-4:1.9764-462.el9.x86_64
Complete!
设置自启动服务
[root@kubecc ~]# systemctl enable --now mysqld
[root@kubecc ~]# systemctl status mysqld.service
● mysqld.service - MySQL Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; preset: disabled)
Active: active (running) since Tue 2025-08-05 10:57:57 CST; 5s ago
Docs: man:mysqld(8)
http://dev.mysql.com/doc/refman/en/using-systemd.html
Process: 94262 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
Main PID: 94333 (mysqld)
Status: "Server is operational"
Tasks: 35 (limit: 48307)
Memory: 438.5M
CPU: 4.243s
CGroup: /system.slice/mysqld.service
└─94333 /usr/sbin/mysqld
Aug 05 10:57:49 kubecc systemd[1]: Starting MySQL Server…
Aug 05 10:57:57 kubecc systemd[1]: Started MySQL Server.
修改初始密码
[root@kubecc ~]# cat /var/log/mysqld.log | grep password # 获取初始密码
2025-08-05T02:57:53.377557Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: (J7KfP(D5.t8
[root@kubecc ~]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 8.4.6
Copyright (c) 2000, 2025, 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> ALTER USER 'root'@'localhost' IDENTIFIED BY 'As%&a12BC,';
Query OK, 0 rows affected (0.01 sec)
mysql> exit
Bye
# 使用修改后的密码登录
[root@kubecc ~]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 8.4.6 MySQL Community Server - GPL
Copyright (c) 2000, 2025, 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> SELECT user, plugin,authentication_string FROM mysql.user;
+------------------+-----------------------+------------------------------------------------------------------------+
| user | plugin | authentication_string |
+------------------+-----------------------+------------------------------------------------------------------------+
| mysql.infoschema | caching_sha2_password | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED |
| mysql.session | caching_sha2_password | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED |
| mysql.sys | caching_sha2_password | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED |
| root | caching_sha2_password | $A$115$X~2:
h
JPuI>lMf
r0IBNqYVhgEsBLY7qmBgIL1iIcwmtylAFGSTsuZALGsx/C |
+------------------+-----------------------+------------------------------------------------------------------------+
4 rows in set (0.00 sec)
结语
在 Rocky Linux 服务器上,安装和运行 MySQL 有多种方式,您可以根据实际需求选择最合适的方法。通过 RPM 离线包安装方式简单快捷,您也可以使用官方 YUM 仓库进行在线安装或者使用二进制方式部署(适用于生产环境)。
参考文献
[1] MySQL 8.4 参考手册
[2] MySQL 8.4 自 MySQL 8.0 以来的新功能

要想成为扫地僧,需要不断的学习进步,这个世界,在悄悄惩罚那些不改变的人