环境概述
操作系统:Centos7.9
MySQL版本:8.0.34
错误提示
[root@s2 yum.repos.d]# /soft/mysql/bin/mysqld --initialize --user=mysql --basedir=/soft/mysql --datadir=/soft/mysql/data
/soft/mysql/bin/mysqld: /lib64/libstdc++.so.6: version `CXXABI_1.3.11' not found (required by /soft/mysql/bin/mysqld)
/soft/mysql/bin/mysqld: /lib64/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by /soft/mysql/bin/mysqld)
/soft/mysql/bin/mysqld: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.22' not found (required by /soft/mysql/bin/mysqld)
/soft/mysql/bin/mysqld: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /soft/mysql/bin/mysqld)
/soft/mysql/bin/mysqld: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /soft/mysql/bin/mysqld)
/soft/mysql/bin/mysqld: /lib64/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by /soft/mysql/bin/mysqld)
/soft/mysql/bin/mysqld: /lib64/libm.so.6: version `GLIBC_2.27' not found (required by /soft/mysql/bin/mysqld)
/soft/mysql/bin/mysqld: /lib64/libc.so.6: version `GLIBC_2.28' not found (required by /soft/mysql/bin/mysqld)
/soft/mysql/bin/mysqld: /lib64/libc.so.6: version `GLIBC_2.25' not found (required by /soft/mysql/bin/../lib/private/libcrypto.so.3)
/soft/mysql/bin/mysqld: /lib64/libc.so.6: version `GLIBC_2.28' not found (required by /soft/mysql/bin/../lib/private/libprotobuf-lite.so.3.19.4)
/soft/mysql/bin/mysqld: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /soft/mysql/bin/../lib/private/libprotobuf-lite.so.3.19.4)
/soft/mysql/bin/mysqld: /lib64/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by /soft/mysql/bin/../lib/private/libprotobuf-lite.so.3.19.4)
/soft/mysql/bin/mysqld: /lib64/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by /soft/mysql/bin/../lib/private/libprotobuf-lite.so.3.19.4)
/soft/mysql/bin/mysqld: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /soft/mysql/bin/../lib/private/libprotobuf-lite.so.3.19.4)
问题原因
libstdc++.so.6系列报错是由于当前动态库版本较低不满足软件的先决条件,从错误来看至少需要22以上的版本,用高版本(libstdc++.so.6.0.25或者更高)替换后从新创建软件连接即可。
libm.so.6、libc.so.6错误由于glibc版本较低导致,从错误来看至少需要2.28的版本
解决办法
问题1
将libstdc++.so.6.0.25放入/usr/lib64/libstdc++.so.6.0.25
删除原有的libstdc++.so.6
建立新的软件链接
ln -vs libstdc++.so.6.0.25 libstdc++.so.6
问题2
编译安装glibc-2.28
下载地址:http://ftp.gnu.org/gnu/glibc/glibc-2.28.tar.gz
centos7.9 make和gcc版本较低,无法通过先决条件需要升级
yum install centos-release-scl -y
yum install devtoolset-7 -y
scl enable devtoolset-7 bash
激活Developer Toolset 7软件集,并创建Shell
source scl_source enable devtoolset-7
开始编译安装glibc
cd glibc-2.28 && mkdir -p build
cd build/
make -j all
make install
解决完上述问题后即可正常安装MySQL8.0.34!