CentOS 7安装 mysql-8.0.27-1.el7.x86_64.rpm 安装包

访问地址:

https://mirrors.aliyun.com/mysql/MySQL-8.0/?spm=a2c6h.25603864.0.0.17ec2ca8dkeWtv

CentOS 7 专用的 MySQL 8.0 安装包就是下面这个:

bash 复制代码
mysql-8.0.27-1.el7.x86_64.rpm-bundle.tar

✅ 下载 & 安装步骤

1. 下载这个包(两种方式)
  • 方式 1:浏览器直接下点这个文件下载,保存到电脑,再上传到你的 CentOS 7 服务器上。

  • 方式 2:服务器上用 wget 直接下

    复制代码
    wget https://mirrors.aliyun.com/mysql/MySQL-8.0/mysql-8.0.27-1.el7.x86_64.rpm-bundle.tar
2. 解压安装包
bash 复制代码
# 解压 tar 包
tar -xvf mysql-8.0.27-1.el7.x86_64.rpm-bundle.tar

# 解压后会生成一堆 .rpm 文件,我们只需要安装核心的几个:
# mysql-community-common-*.rpm
# mysql-community-libs-*.rpm
# mysql-community-client-*.rpm
# mysql-community-server-*.rpm
3. 按顺序安装(解决依赖)
bash 复制代码
# 先卸载系统自带的 mariadb-libs,避免冲突
yum remove -y mariadb-libs
bash 复制代码
# 安装依赖包
rpm -ivh mysql-community-common-8.0.27-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-8.0.27-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-8.0.27-1.el7.x86_64.rpm
rpm -ivh mysql-community-server-8.0.27-1.el7.x86_64.rpm



#------------------------------------------
# 或者使用下面安装

rpm -ivh mysql-community-*.rpm --nodeps --force
4. 启动 & 初始化 MySQL
bash 复制代码
# 启动服务
systemctl start mysqld
# 开机自启
systemctl enable mysqld

# 查看初始临时密码
grep 'temporary password' /var/log/mysqld.log

# 登录并修改密码
mysql -uroot -p
ALTER USER 'root'@'localhost' IDENTIFIED BY '你的强密码';

卸载现在装坏的 MySQL(必须做)

bash 复制代码
rpm -e --nodeps mysql-community-server
rpm -e --nodeps mysql-community-client
rpm -e --nodeps mysql-community-libs
rpm -e --nodeps mysql-community-common
rpm -e --nodeps mysql-community-client-plugins

启动报错

Job for mysqld.service failed because the control process exited with error code. See "systemctl status mysqld.service" and "journalctl -xe" for details.

看启动失败的具体原因

先执行下面的命令,看看到底是什么问题:

复制代码
# 查看服务状态
systemctl status mysqld.service

# 查看详细日志
journalctl -xe | grep mysqld
bash 复制代码
journalctl -xe | grep mysqld
-- Subject: Unit mysqld.service has begun start-up
-- Unit mysqld.service has begun starting up.
May 13 12:52:48 iZ0jlgpxxeb31ngiadjy9gZ mysqld_pre_systemd[64967]: /usr/bin/my_print_defaults: error while loading shared libraries: libssl.so.10: cannot open shared object file: No such file or directory
May 13 12:52:48 iZ0jlgpxxeb31ngiadjy9gZ mysqld_pre_systemd[64973]: /usr/bin/my_print_defaults: error while loading shared libraries: libssl.so.10: cannot open shared object file: No such file or directory
May 13 12:52:48 iZ0jlgpxxeb31ngiadjy9gZ mysqld_pre_systemd[64979]: /usr/bin/my_print_defaults: error while loading shared libraries: libssl.so.10: cannot open shared object file: No such file or directory
May 13 12:52:48 iZ0jlgpxxeb31ngiadjy9gZ mysqld_pre_systemd[64993]: /usr/sbin/mysqld: error while loading shared libraries: libssl.so.10: cannot open shared object file: No such file or directory
May 13 12:52:48 iZ0jlgpxxeb31ngiadjy9gZ mysqld[64997]: /usr/sbin/mysqld: error while loading shared libraries: libssl.so.10: cannot open shared object file: No such file or directory
May 13 12:52:48 iZ0jlgpxxeb31ngiadjy9gZ systemd[1]: mysqld.service: Main process exited, code=exited, status=127/n/a
May 13 12:52:48 iZ0jlgpxxeb31ngiadjy9gZ systemd[1]: mysqld.service: Failed with result 'exit-code'.
-- The unit mysqld.service has entered the 'failed' state with result 'exit-code'.
-- Subject: Unit mysqld.service has failed
-- Unit mysqld.service has failed.
May 13 12:52:48 iZ0jlgpxxeb31ngiadjy9gZ systemd[1]: mysqld.service: Service RestartSec=100ms expired, scheduling restart.
May 13 12:52:48 iZ0jlgpxxeb31ngiadjy9gZ systemd[1]: mysqld.service: Scheduled restart job, restart counter is at 1.
-- Automatic restarting of the unit mysqld.service has been scheduled, as the result for
-- Subject: Unit mysqld.service has finished shutting down
-- Unit mysqld.service has finished shutting down.
-- Subject: Unit mysqld.service has begun start-up
-- Unit mysqld.service has begun starting up.
May 13 12:52:48 iZ0jlgpxxeb31ngiadjy9gZ mysqld_pre_systemd[65004]: /usr/bin/my_print_defaults: error while loading shared libraries: libssl.so.10: cannot open shared object file: No such file or directory
May 13 12:52:48 iZ0jlgpxxeb31ngiadjy9gZ mysqld_pre_systemd[65010]: /usr/bin/my_print_defaults: error while loading shared libraries: libssl.so.10: cannot open shared object file: No such file or directory
May 13 12:52:48 iZ0jlgpxxeb31ngiadjy9gZ mysqld_pre_systemd[65016]: /usr/bin/my_print_defaults: error while loading shared libraries: libssl.so.10: cannot open shared object file: No such file or directory
May 13 12:52:48 iZ0jlgpxxeb31ngiadjy9gZ mysqld_pre_systemd[65028]: /usr/sbin/mysqld: error while loading shared libraries: libssl.so.10: cannot open shared object file: No such file or directory
May 13 12:52:48 iZ0jlgpxxeb31ngiadjy9gZ mysqld[65032]: /usr/sbin/mysqld: error while loading shared libraries: libssl.so.10: cannot open shared object file: No such file or directory
May 13 12:52:48 iZ0jlgpxxeb31ngiadjy9gZ systemd[1]: mysqld.service: Main process exited, code=exited, status=127/n/a
May 13 12:52:48 iZ0jlgpxxeb31ngiadjy9gZ systemd[1]: mysqld.service: Failed with result 'exit-code'.
-- The unit mysqld.service has entered the 'failed' state with result 'exit-code'.
-- Subject: Unit mysqld.service has failed
-- Unit mysqld.service has failed.
May 13 12:52:48 iZ0jlgpxxeb31ngiadjy9gZ systemd[1]: mysqld.service: Service RestartSec=100ms expired, scheduling restart.
May 13 12:52:48 iZ0jlgpxxeb31ngiadjy9gZ systemd[1]: mysqld.service: Scheduled restart job, restart counter is at 2.
-- Automatic restarting of the unit mysqld.service has been scheduled, as the result for
-- Subject: Unit mysqld.service has finished shutting down
-- Unit mysqld.service has finished shutting down.
-- Subject: Unit mysqld.service has begun start-up
-- Unit mysqld.service has begun starting up.
May 13 12:52:48 iZ0jlgpxxeb31ngiadjy9gZ mysqld_pre_systemd[65044]: /usr/bin/my_print_defaults: error while loading shared libraries: libssl.so.10: cannot open shared object file: No such file or directory
May 13 12:52:48 iZ0jlgpxxeb31ngiadjy9gZ mysqld_pre_systemd[65050]: /usr/bin/my_print_defaults: error while loading shared libraries: libssl.so.10: cannot open shared object file: No such file or directory
May 13 12:52:48 iZ0jlgpxxeb31ngiadjy9gZ mysqld_pre_systemd[65056]: /usr/bin/my_print_defaults: error while loading shared libraries: libssl.so.10: cannot open shared object file: No such file or directory
May 13 12:52:48 iZ0jlgpxxeb31ngiadjy9gZ mysqld_pre_systemd[65068]: /usr/sbin/mysqld: error while loading shared libraries: libssl.so.10: cannot open shared object file: No such file or directory
May 13 12:52:48 iZ0jlgpxxeb31ngiadjy9gZ mysqld[65072]: /usr/sbin/mysqld: error while loading shared libraries: libssl.so.10: cannot open shared object file: No such file or directory
May 13 12:52:48 iZ0jlgpxxeb31ngiadjy9gZ systemd[1]: mysqld.service: Main process exited, code=exited, status=127/n/a
May 13 12:52:48 iZ0jlgpxxeb31ngiadjy9gZ systemd[1]: mysqld.service: Failed with result 'exit-code'.
-- The unit mysqld.service has entered the 'failed' state with result 'exit-code'.
-- Subject: Unit mysqld.service has failed
-- Unit mysqld.service has failed.
May 13 12:52:49 iZ0jlgpxxeb31ngiadjy9gZ systemd[1]: mysqld.service: Service RestartSec=100ms expired, scheduling restart.
May 13 12:52:49 iZ0jlgpxxeb31ngiadjy9gZ systemd[1]: mysqld.service: Scheduled restart job, restart counter is at 3.
-- Automatic restarting of the unit mysqld.service has been scheduled, as the result for
-- Subject: Unit mysqld.service has finished shutting down
-- Unit mysqld.service has finished shutting down.
-- Subject: Unit mysqld.service has begun start-up
-- Unit mysqld.service has begun starting up.
May 13 12:52:49 iZ0jlgpxxeb31ngiadjy9gZ mysqld_pre_systemd[65077]: /usr/bin/my_print_defaults: error while loading shared libraries: libssl.so.10: cannot open shared object file: No such file or directory
May 13 12:52:49 iZ0jlgpxxeb31ngiadjy9gZ mysqld_pre_systemd[65083]: /usr/bin/my_print_defaults: error while loading shared libraries: libssl.so.10: cannot open shared object file: No such file or directory
May 13 12:52:49 iZ0jlgpxxeb31ngiadjy9gZ mysqld_pre_systemd[65089]: /usr/bin/my_print_defaults: error while loading shared libraries: libssl.so.10: cannot open shared object file: No such file or directory
May 13 12:52:49 iZ0jlgpxxeb31ngiadjy9gZ mysqld_pre_systemd[65101]: /usr/sbin/mysqld: error while loading shared libraries: libssl.so.10: cannot open shared object file: No such file or directory
May 13 12:52:49 iZ0jlgpxxeb31ngiadjy9gZ mysqld[65105]: /usr/sbin/mysqld: error while loading shared libraries: libssl.so.10: cannot open shared object file: No such file or directory
May 13 12:52:49 iZ0jlgpxxeb31ngiadjy9gZ systemd[1]: mysqld.service: Main process exited, code=exited, status=127/n/a
May 13 12:52:49 iZ0jlgpxxeb31ngiadjy9gZ systemd[1]: mysqld.service: Failed with result 'exit-code'.
-- The unit mysqld.service has entered the 'failed' state with result 'exit-code'.
-- Subject: Unit mysqld.service has failed
-- Unit mysqld.service has failed.
May 13 12:52:49 iZ0jlgpxxeb31ngiadjy9gZ systemd[1]: mysqld.service: Service RestartSec=100ms expired, scheduling restart.
May 13 12:52:49 iZ0jlgpxxeb31ngiadjy9gZ systemd[1]: mysqld.service: Scheduled restart job, restart counter is at 4.
-- Automatic restarting of the unit mysqld.service has been scheduled, as the result for
-- Subject: Unit mysqld.service has finished shutting down
-- Unit mysqld.service has finished shutting down.
-- Subject: Unit mysqld.service has begun start-up
-- Unit mysqld.service has begun starting up.
May 13 12:52:49 iZ0jlgpxxeb31ngiadjy9gZ mysqld_pre_systemd[65111]: /usr/bin/my_print_defaults: error while loading shared libraries: libssl.so.10: cannot open shared object file: No such file or directory
May 13 12:52:49 iZ0jlgpxxeb31ngiadjy9gZ mysqld_pre_systemd[65117]: /usr/bin/my_print_defaults: error while loading shared libraries: libssl.so.10: cannot open shared object file: No such file or directory
May 13 12:52:49 iZ0jlgpxxeb31ngiadjy9gZ mysqld_pre_systemd[65123]: /usr/bin/my_print_defaults: error while loading shared libraries: libssl.so.10: cannot open shared object file: No such file or directory
May 13 12:52:49 iZ0jlgpxxeb31ngiadjy9gZ mysqld_pre_systemd[65135]: /usr/sbin/mysqld: error while loading shared libraries: libssl.so.10: cannot open shared object file: No such file or directory
May 13 12:52:49 iZ0jlgpxxeb31ngiadjy9gZ mysqld[65139]: /usr/sbin/mysqld: error while loading shared libraries: libssl.so.10: cannot open shared object file: No such file or directory
May 13 12:52:49 iZ0jlgpxxeb31ngiadjy9gZ systemd[1]: mysqld.service: Main process exited, code=exited, status=127/n/a
May 13 12:52:49 iZ0jlgpxxeb31ngiadjy9gZ systemd[1]: mysqld.service: Failed with result 'exit-code'.
-- The unit mysqld.service has entered the 'failed' state with result 'exit-code'.
-- Subject: Unit mysqld.service has failed
-- Unit mysqld.service has failed.
May 13 12:52:49 iZ0jlgpxxeb31ngiadjy9gZ systemd[1]: mysqld.service: Service RestartSec=100ms expired, scheduling restart.
May 13 12:52:49 iZ0jlgpxxeb31ngiadjy9gZ systemd[1]: mysqld.service: Scheduled restart job, restart counter is at 5.
-- Automatic restarting of the unit mysqld.service has been scheduled, as the result for
-- Subject: Unit mysqld.service has finished shutting down
-- Unit mysqld.service has finished shutting down.
May 13 12:52:49 iZ0jlgpxxeb31ngiadjy9gZ systemd[1]: mysqld.service: Start request repeated too quickly.
May 13 12:52:49 iZ0jlgpxxeb31ngiadjy9gZ systemd[1]: mysqld.service: Failed with result 'exit-code'.
-- The unit mysqld.service has entered the 'failed' state with result 'exit-code'.
-- Subject: Unit mysqld.service has failed
-- Unit mysqld.service has failed.

核心报错只有一句:

libssl.so.10: cannot open shared object file: No such file or directory

你的 CentOS7 缺少 OpenSSL10 兼容库 ,所以 MySQL 启动直接失败。我现在给你一键修复命令,复制运行就能解决!


🔥 直接复制这 3 行,100% 解决问题

bash 复制代码
yum install -y openssl10 openssl10-devel
ln -s /usr/lib64/libssl.so.10 /usr/lib64/libssl.so.1.0.0
ln -s /usr/lib64/libcrypto.so.10 /usr/lib64/libcrypto.so.1.0.0



相关推荐
plainGeekDev13 小时前
工厂模式 → Hilt
android·java·kotlin
雨白13 小时前
深入理解 Kotlin 协程 (十):引而不发,探秘 Flow 冷流机制与异常透明性
android·kotlin
plainGeekDev13 小时前
Application 单例 → Hilt Singleton
android·java·kotlin
程序员码歌14 小时前
我全程用 AI开发了一款微信小游戏,上线了
android·前端·游戏开发
黄林晴15 小时前
你敢信吗?同样是跨端,KMP 跟 RN 居然差这么多!
android·前端
zbmwa16 小时前
jetpack compose 副作用 produceState
android
全栈派森17 小时前
告别大表膨胀!MySQL 冷热分离落地全过程(含 CDC 与单行锁抢占实战)
大数据·mysql
篮框坏了17 小时前
大事务 DELETE 锁表排查:删 3344 万行,一个清理任务变成周期炸弹
mysql
hunterandroid17 小时前
Android 后台任务可靠性排查:从 WorkManager 观测到失败重试闭环
android·前端
LinuxGeek102418 小时前
Kylin-Server-V11、openEuler-22.03和openEuler-24.03适配原生rpm的MySQL 8.4.11版本正式发布
大数据·mysql·kylin