前言
最近想尝试一下最新的 MySQL 9.7 LTS,于是在本地重新安装了 Rocky Linux 10.1 Minimal 版。本以为 Minimal 安装会很干净,结果却被 MariaDB 折腾得死去活来,花了大量时间也没能成功安装 MySQL 9.7,最终选择放弃。
记录一下整个过程,希望能帮到同样踩坑的朋友。
安装环境
- 系统:Rocky Linux 10.1 Minimal
- 安装方式:官方 Minimal ISO 干净安装
- 目标:安装官方 MySQL Community Server 9.7.1
安装过程与问题
-
系统安装完成后,第一时间执行了 dnf update -y 并重启。
-
按照官方文档添加 MySQL Yum 仓库:
Bash
sqlsudo dnf install -y https://dev.mysql.com/get/mysql84-community-release-el10-3.noarch.rpm -
尝试安装 MySQL 9.7:
Bash
vbscriptsudo dnf install -y mysql-community-server mysql-community-client
然后就遇到了漫长的冲突地狱:
错误核心是各种文件冲突:
- /usr/bin/mysql
- /usr/bin/mysqldump
- /usr/sbin/mysqld
- /var/lib/mysql
- 等等......
冲突来源:
- mariadb11.8 系列包(Rocky Linux 10 默认 AppStream 组件)
- 后来还发现了 mysql8.4(Rocky 自带版本)
text
Running transaction check
Transaction check succeeded.
Running transaction test
The downloaded packages were saved in cache until the next successful transaction.
You can remove cached packages by executing 'dnf clean packages'.
Error: Transaction test error:
file /usr/bin/mysql conflicts between attempted installs of mariadb11.8-3:11.8.8-1.el10_2.x86_64 and mysql-community-client-9.7.1-1.el10.x86_64
file /usr/bin/mysqladmin conflicts between attempted installs of mariadb11.8-3:11.8.8-1.el10_2.x86_64 and mysql-community-client-9.7.1-1.el10.x86_64
file /usr/bin/mysqlbinlog conflicts between attempted installs of mariadb11.8-3:11.8.8-1.el10_2.x86_64 and mysql-community-client-9.7.1-1.el10.x86_64
file /usr/bin/mysqlcheck conflicts between attempted installs of mariadb11.8-3:11.8.8-1.el10_2.x86_64 and mysql-community-client-9.7.1-1.el10.x86_64
file /usr/bin/mysqldump conflicts between attempted installs of mariadb11.8-3:11.8.8-1.el10_2.x86_64 and mysql-community-client-9.7.1-1.el10.x86_64
file /usr/bin/mysqlimport conflicts between attempted installs of mariadb11.8-3:11.8.8-1.el10_2.x86_64 and mysql-community-client-9.7.1-1.el10.x86_64
file /usr/bin/mysqlshow conflicts between attempted installs of mariadb11.8-3:11.8.8-1.el10_2.x86_64 and mysql-community-client-9.7.1-1.el10.x86_64
file /usr/bin/mysqlslap conflicts between attempted installs of mariadb11.8-3:11.8.8-1.el10_2.x86_64 and mysql-community-client-9.7.1-1.el10.x86_64
file /usr/share/man/man1/mysql.1.gz conflicts between attempted installs of mariadb11.8-3:11.8.8-1.el10_2.x86_64 and mysql-community-client-9.7.1-1.el10.x86_64
file /usr/share/man/man1/mysqladmin.1.gz conflicts between attempted installs of mariadb11.8-3:11.8.8-1.el10_2.x86_64 and mysql-community-client-9.7.1-1.el10.x86_64
file /usr/share/man/man1/mysqlbinlog.1.gz conflicts between attempted installs of mariadb11.8-3:11.8.8-1.el10_2.x86_64 and mysql-community-client-9.7.1-1.el10.x86_64
file /usr/share/man/man1/mysqlcheck.1.gz conflicts between attempted installs of mariadb11.8-3:11.8.8-1.el10_2.x86_64 and mysql-community-client-9.7.1-1.el10.x86_64
file /usr/share/man/man1/mysqldump.1.gz conflicts between attempted installs of mariadb11.8-3:11.8.8-1.el10_2.x86_64 and mysql-community-client-9.7.1-1.el10.x86_64
file /usr/share/man/man1/mysqlimport.1.gz conflicts between attempted installs of mariadb11.8-3:11.8.8-1.el10_2.x86_64 and mysql-community-client-9.7.1-1.el10.x86_64
file /usr/share/man/man1/mysqlshow.1.gz conflicts between attempted installs of mariadb11.8-3:11.8.8-1.el10_2.x86_64 and mysql-community-client-9.7.1-1.el10.x86_64
file /usr/share/man/man1/mysqlslap.1.gz conflicts between attempted installs of mariadb11.8-3:11.8.8-1.el10_2.x86_64 and mysql-community-client-9.7.1-1.el10.x86_64
file /usr/bin/innochecksum conflicts between attempted installs of mysql-community-server-9.7.1-1.el10.x86_64 and mariadb11.8-server-3:11.8.8-1.el10_2.x86_64
file /usr/bin/my_print_defaults conflicts between attempted installs of mysql-community-server-9.7.1-1.el10.x86_64 and mariadb11.8-3:11.8.8-1.el10_2.x86_64
file /usr/bin/myisam_ftdump conflicts between attempted installs of mysql-community-server-9.7.1-1.el10.x86_64 and mariadb11.8-server-3:11.8.8-1.el10_2.x86_64
file /usr/bin/myisamchk conflicts between attempted installs of mysql-community-server-9.7.1-1.el10.x86_64 and mariadb11.8-server-3:11.8.8-1.el10_2.x86_64
file /usr/bin/myisamlog conflicts between attempted installs of mysql-community-server-9.7.1-1.el10.x86_64 and mariadb11.8-server-3:11.8.8-1.el10_2.x86_64
file /usr/bin/myisampack conflicts between attempted installs of mysql-community-server-9.7.1-1.el10.x86_64 and mariadb11.8-server-3:11.8.8-1.el10_2.x86_64
file /usr/bin/mysql_secure_installation conflicts between attempted installs of mysql-community-server-9.7.1-1.el10.x86_64 and mariadb11.8-server-3:11.8.8-1.el10_2.x86_64
file /usr/bin/mysql_tzinfo_to_sql conflicts between attempted installs of mysql-community-server-9.7.1-1.el10.x86_64 and mariadb11.8-3:11.8.8-1.el10_2.x86_64
file /usr/bin/mysqldumpslow conflicts between attempted installs of mysql-community-server-9.7.1-1.el10.x86_64 and mariadb11.8-client-utils-3:11.8.8-1.el10_2.noarch
file /usr/bin/perror conflicts between attempted installs of mysql-community-server-9.7.1-1.el10.x86_64 and mariadb11.8-server-3:11.8.8-1.el10_2.x86_64
file /usr/lib/systemd/system/mysqld.service conflicts between attempted installs of mysql-community-server-9.7.1-1.el10.x86_64 and mariadb11.8-server-3:11.8.8-1.el10_2.x86_64
file /usr/sbin/mysqld conflicts between attempted installs of mysql-community-server-9.7.1-1.el10.x86_64 and mariadb11.8-server-3:11.8.8-1.el10_2.x86_64
file /usr/share/man/man1/innochecksum.1.gz conflicts between attempted installs of mysql-community-server-9.7.1-1.el10.x86_64 and mariadb11.8-server-3:11.8.8-1.el10_2.x86_64
file /usr/share/man/man1/my_print_defaults.1.gz conflicts between attempted installs of mysql-community-server-9.7.1-1.el10.x86_64 and mariadb11.8-3:11.8.8-1.el10_2.x86_64
file /usr/share/man/man1/myisam_ftdump.1.gz conflicts between attempted installs of mysql-community-server-9.7.1-1.el10.x86_64 and mariadb11.8-server-3:11.8.8-1.el10_2.x86_64
file /usr/share/man/man1/myisamchk.1.gz conflicts between attempted installs of mysql-community-server-9.7.1-1.el10.x86_64 and mariadb11.8-server-3:11.8.8-1.el10_2.x86_64
file /usr/share/man/man1/myisamlog.1.gz conflicts between attempted installs of mysql-community-server-9.7.1-1.el10.x86_64 and mariadb11.8-server-3:11.8.8-1.el10_2.x86_64
file /usr/share/man/man1/myisampack.1.gz conflicts between attempted installs of mysql-community-server-9.7.1-1.el10.x86_64 and mariadb11.8-server-3:11.8.8-1.el10_2.x86_64
file /usr/share/man/man1/mysql_secure_installation.1.gz conflicts between attempted installs of mysql-community-server-9.7.1-1.el10.x86_64 and mariadb11.8-server-3:11.8.8-1.el10_2.x86_64
file /usr/share/man/man1/mysql_tzinfo_to_sql.1.gz conflicts between attempted installs of mysql-community-server-9.7.1-1.el10.x86_64 and mariadb11.8-3:11.8.8-1.el10_2.x86_64
file /usr/share/man/man1/mysqldumpslow.1.gz conflicts between attempted installs of mysql-community-server-9.7.1-1.el10.x86_64 and mariadb11.8-client-utils-3:11.8.8-1.el10_2.noarch
file /usr/share/man/man1/perror.1.gz conflicts between attempted installs of mysql-community-server-9.7.1-1.el10.x86_64 and mariadb11.8-server-3:11.8.8-1.el10_2.x86_64
file /usr/share/man/man8/mysqld.8.gz conflicts between attempted installs of mysql-community-server-9.7.1-1.el10.x86_64 and mariadb11.8-server-3:11.8.8-1.el10_2.x86_64
file /var/lib/mysql conflicts between attempted installs of mysql-community-server-9.7.1-1.el10.x86_64 and mariadb11.8-server-3:11.8.8-1.el10_2.x86_64
尝试过的清理手段
我先后尝试了以下方法(多次重复):
- dnf remove --allowerasing mariadb* MariaDB* mysql*
- dnf module disable mariadb mysql
- 手动删除 /etc/my.cnf*、/var/lib/mysql*、/usr/bin/mysql* 等目录
- 重装系统后立即清理(Minimal 版)
- 使用 --allowerasing 强制安装
结果依然失败,MariaDB 的文件残留得非常顽固。
总结与建议
Rocky Linux 10(包括 AlmaLinux 10、RHEL 10)在数据库替换上确实做得不够友好。MariaDB 被深度集成进了系统,即使是 Minimal 安装,也很难彻底移除。
给同样想在 Rocky Linux 10 上用 MySQL 9.7 的朋友的建议:
- 如果不是必须使用 Rocky,强烈推荐 Ubuntu 24.04,安装 MySQL 体验好太多。
- 使用 Docker 运行官方 MySQL 镜像(最干净的方式)。
- 考虑直接使用 PostgreSQL + pgvector(向量搜索场景下体验更好)。
- 或者直接上云数据库,避免本地这些麻烦事。
后记
本以为 Minimal 安装会很清爽,结果还是被系统默认组件坑了。希望 Rocky Linux 后续版本能在数据库替换友好度上有所改进。