分类: MySQL
CentOS7.9二进制安装MySQL8.1初始化报错/lib64/libstdc++.so.6问题处理

初始化时报错/lib64/libstdc++.so.6: version `CXXABI_1.3.11' not found :详细log如下:

[root@c9 data]# /usr/local/mysql/bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql
/usr/local/mysql/bin/mysqld: /lib64/libstdc++.so.6: version `CXXABI_1.3.11' not found (required by /usr/local/mysql/bin/mysqld)
/usr/local/mysql/bin/mysqld: /lib64/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by /usr/local/mysql/bin/mysqld)
/usr/local/mysql/bin/mysqld: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.22' not found (required by /usr/local/mysql/bin/mysqld)
/usr/local/mysql/bin/mysqld: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/local/mysql/bin/mysqld)
/usr/local/mysql/bin/mysqld: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /usr/local/mysql/bin/mysqld)
/usr/local/mysql/bin/mysqld: /lib64/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by /usr/local/mysql/bin/mysqld)
/usr/local/mysql/bin/mysqld: /lib64/libm.so.6: version `GLIBC_2.27' not found (required by /usr/local/mysql/bin/mysqld)
/usr/local/mysql/bin/mysqld: /lib64/libc.so.6: version `GLIBC_2.28' not found (required by /usr/local/mysql/bin/mysqld)
/usr/local/mysql/bin/mysqld: /lib64/libc.so.6: version `GLIBC_2.25' not found (required by /usr/local/mysql-8.1.0-linux-glibc2.28-x86_64/bin/../lib/private/libcrypto.so.3)
/usr/local/mysql/bin/mysqld: /lib64/libc.so.6: version `GLIBC_2.28' not found (required by /usr/local/mysql-8.1.0-linux-glibc2.28-x86_64/bin/../lib/private/libprotobuf-lite.so.3.19.4)
/usr/local/mysql/bin/mysqld: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/local/mysql-8.1.0-linux-glibc2.28-x86_64/bin/../lib/private/libprotobuf-lite.so.3.19.4)
/usr/local/mysql/bin/mysqld: /lib64/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by /usr/local/mysql-8.1.0-linux-glibc2.28-x86_64/bin/../lib/private/libprotobuf-lite.so.3.19.4)
/usr/local/mysql/bin/mysqld: /lib64/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by /usr/local/mysql-8.1.0-linux-glibc2.28-x86_64/bin/../lib/private/libprotobuf-lite.so.3.19.4)
/usr/local/mysql/bin/mysqld: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /usr/local/mysql-8.1.0-linux-glibc2.28-x86_64/bin/../lib/private/libprotobuf-lite.so.3.19.4)

查看GLIBCXX版本:

[root@c9 data]# strings /usr/lib64/libstdc++.so.6 | grep 'GLIBCXX'
GLIBCXX_3.4
GLIBCXX_3.4.1
GLIBCXX_3.4.2
GLIBCXX_3.4.3
GLIBCXX_3.4.4
GLIBCXX_3.4.5
GLIBCXX_3.4.6
GLIBCXX_3.4.7
GLIBCXX_3.4.8
GLIBCXX_3.4.9
GLIBCXX_3.4.10
GLIBCXX_3.4.11
GLIBCXX_3.4.12
GLIBCXX_3.4.13
GLIBCXX_3.4.14
GLIBCXX_3.4.15
GLIBCXX_3.4.16
GLIBCXX_3.4.17
GLIBCXX_3.4.18
GLIBCXX_3.4.19
GLIBCXX_DEBUG_MESSAGE_LENGTH

查看CXXABI版本:

[root@c9 data]# strings /usr/lib64/libstdc++.so.6 | grep 'CXXABI'
CXXABI_1.3
CXXABI_1.3.1
CXXABI_1.3.2
CXXABI_1.3.3
CXXABI_1.3.4
CXXABI_1.3.5
CXXABI_1.3.6
CXXABI_1.3.7
CXXABI_TM_1

解决方法:

[root@c9 opt]# wget http://ftp.de.debian.org/debian/pool/main/g/gcc-8/libstdc++6_8.3.0-6_amd64.deb
[root@c9 opt]# ar -x libstdc++6_8.3.0-6_amd64.deb
[root@c9 opt]# tar xvf data.tar.xz
./
./usr/
./usr/lib/
./usr/lib/x86_64-linux-gnu/
./usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.25
./usr/share/
./usr/share/doc/
./usr/share/gcc-8/
./usr/share/gcc-8/python/
./usr/share/gcc-8/python/libstdcxx/
./usr/share/gcc-8/python/libstdcxx/__init__.py
./usr/share/gcc-8/python/libstdcxx/v6/
./usr/share/gcc-8/python/libstdcxx/v6/__init__.py
./usr/share/gcc-8/python/libstdcxx/v6/printers.py
./usr/share/gcc-8/python/libstdcxx/v6/xmethods.py
./usr/share/gdb/
./usr/share/gdb/auto-load/
./usr/share/gdb/auto-load/usr/
./usr/share/gdb/auto-load/usr/lib/
./usr/share/gdb/auto-load/usr/lib/x86_64-linux-gnu/
./usr/share/gdb/auto-load/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.25-gdb.py
./usr/lib/x86_64-linux-gnu/libstdc++.so.6
./usr/share/doc/libstdc++6

复制文件做软连接:

[root@c9 opt]# cp /opt/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.25 /usr/lib64/
[root@c9 opt]# ll /usr/lib64/libstd*
lrwxrwxrwx. 1 root root      19 Aug 28 22:36 /usr/lib64/libstdc++.so.6 -> libstdc++.so.6.0.19
-rwxr-xr-x. 1 root root  995840 Sep 30  2020 /usr/lib64/libstdc++.so.6.0.19
-rw-r--r--  1 root root 1570256 Aug 30 09:30 /usr/lib64/libstdc++.so.6.0.25
[root@c9 opt]# rm /usr/lib64/libstdc++.so.6
rm: remove symbolic link ‘/usr/lib64/libstdc++.so.6’? y
[root@c9 opt]# ln -s /usr/lib64/libstdc++.so.6.0.25 /usr/lib64/libstdc++.so.6
[root@c9 opt]# chmod +x /usr/lib64/libstdc++.so.6

查看GLIBC和ldd版本:

[root@c9 opt]# strings /lib64/libc.so.6 | grep 'GLIBC'
GLIBC_2.2.5
GLIBC_2.2.6
GLIBC_2.3
GLIBC_2.3.2
GLIBC_2.3.3
GLIBC_2.3.4
GLIBC_2.4
GLIBC_2.5
GLIBC_2.6
GLIBC_2.7
GLIBC_2.8
GLIBC_2.9
GLIBC_2.10
GLIBC_2.11
GLIBC_2.12
GLIBC_2.13
GLIBC_2.14
GLIBC_2.15
GLIBC_2.16
GLIBC_2.17
GLIBC_PRIVATE
___sys_nerr_GLIBC_2_3
___sys_nerr_GLIBC_2_4
___sys_nerr_GLIBC_2_1
___sys_errlist_GLIBC_2_1
___sys_errlist_GLIBC_2_4
___sys_errlist_GLIBC_2_3
_IO_file_seekoff@@GLIBC_2.2.5
getservent_r@@GLIBC_2.2.5
_sys_siglist@@GLIBC_2.3.3
_dl_starting_up@@GLIBC_PRIVATE
tmpfile@@GLIBC_2.2.5
sched_getaffinity@GLIBC_2.3.3
pthread_cond_wait@GLIBC_2.2.5
regexec@GLIBC_2.2.5
memcpy@@GLIBC_2.14
_IO_file_init@@GLIBC_2.2.5
realpath@GLIBC_2.2.5
realpath@@GLIBC_2.3
__ctype32_tolower@GLIBC_2.2.5
gethostbyname2_r@@GLIBC_2.2.5
getaliasbyname_r@@GLIBC_2.2.5
_IO_file_overflow@@GLIBC_2.2.5
pthread_cond_wait@@GLIBC_2.3.2
getprotoent_r@@GLIBC_2.2.5
regexec@@GLIBC_2.3.4
_rtld_global@@GLIBC_PRIVATE
getgrgid_r@@GLIBC_2.2.5
pthread_cond_init@GLIBC_2.2.5
_IO_fsetpos@@GLIBC_2.2.5
GLIBC_2.8
_IO_proc_close@@GLIBC_2.2.5
_sys_nerr@@GLIBC_2.12
pthread_cond_timedwait@@GLIBC_2.3.2
__libc_enable_secure@@GLIBC_PRIVATE
pclose@@GLIBC_2.2.5
getaliasent_r@@GLIBC_2.2.5
__tls_get_addr@@GLIBC_2.3
_sys_nerr@GLIBC_2.4
sys_sigabbrev@GLIBC_2.2.5
pthread_cond_broadcast@GLIBC_2.2.5
_IO_proc_open@@GLIBC_2.2.5
posix_spawn@@GLIBC_2.15
getpwnam_r@@GLIBC_2.2.5
_rtld_global_ro@@GLIBC_PRIVATE
getrpcbyname_r@@GLIBC_2.2.5
pthread_cond_broadcast@@GLIBC_2.3.2
nftw64@GLIBC_2.2.5
_sys_siglist@GLIBC_2.2.5
_sys_nerr@GLIBC_2.3
_IO_fsetpos64@@GLIBC_2.2.5
__ctype_tolower@GLIBC_2.2.5
__ctype_toupper@GLIBC_2.2.5
_IO_file_underflow@@GLIBC_2.2.5
localeconv@@GLIBC_2.2.5
pthread_cond_timedwait@GLIBC_2.2.5
_IO_file_fopen@@GLIBC_2.2.5
__ctype_b@GLIBC_2.2.5
GLIBC_2.5
_IO_file_finish@@GLIBC_2.2.5
GLIBC_2.9
getgrnam_r@@GLIBC_2.2.5
GLIBC_2.7
GLIBC_2.6
getservbyname_r@@GLIBC_2.2.5
__ctype32_b@GLIBC_2.2.5
_res@GLIBC_2.2.5
__secure_getenv@GLIBC_2.2.5
getnetent_r@@GLIBC_2.2.5
nftw@GLIBC_2.2.5
getpwuid_r@@GLIBC_2.2.5
_IO_fdopen@@GLIBC_2.2.5
posix_spawn@GLIBC_2.2.5
gethostbyaddr_r@@GLIBC_2.2.5
_IO_file_xsputn@@GLIBC_2.2.5
pthread_attr_init@@GLIBC_2.2.5
getrpcbynumber_r@@GLIBC_2.2.5
_IO_fopen@@GLIBC_2.2.5
getnetbyname_r@@GLIBC_2.2.5
memcpy@GLIBC_2.2.5
pthread_cond_signal@@GLIBC_2.3.2
pthread_cond_signal@GLIBC_2.2.5
sys_sigabbrev@@GLIBC_2.3.3
_IO_fgetpos@@GLIBC_2.2.5
posix_spawnp@@GLIBC_2.15
_IO_file_setbuf@@GLIBC_2.2.5
getservbyport_r@@GLIBC_2.2.5
_sys_errlist@GLIBC_2.3
_IO_file_attach@@GLIBC_2.2.5
gethostent_r@@GLIBC_2.2.5
_sys_errlist@GLIBC_2.4
_sys_nerr@GLIBC_2.2.5
nftw64@@GLIBC_2.3.3
_IO_fgetpos64@@GLIBC_2.2.5
__res_maybe_init@GLIBC_PRIVATE
fnmatch@@GLIBC_2.2.5
h_errno@GLIBC_PRIVATE
_sys_errlist@@GLIBC_2.12
_IO_fclose@@GLIBC_2.2.5
gethostbyname_r@@GLIBC_2.2.5
_IO_do_write@@GLIBC_2.2.5
getspent_r@@GLIBC_2.2.5
getpwent_r@@GLIBC_2.2.5
pthread_cond_destroy@GLIBC_2.2.5
sched_setaffinity@GLIBC_2.3.3
getspnam_r@@GLIBC_2.2.5
sched_setaffinity@@GLIBC_2.3.4
_IO_popen@@GLIBC_2.2.5
getgrent_r@@GLIBC_2.2.5
_IO_file_sync@@GLIBC_2.2.5
GLIBC_2.11
GLIBC_2.16
GLIBC_2.10
pthread_cond_init@@GLIBC_2.3.2
GLIBC_2.17
getprotobyname_r@@GLIBC_2.2.5
GLIBC_2.13
getnetbyaddr_r@@GLIBC_2.2.5
_sys_errlist@GLIBC_2.2.5
_IO_file_write@@GLIBC_2.2.5
pthread_cond_destroy@@GLIBC_2.3.2
nftw@@GLIBC_2.3.3
GLIBC_2.2.6
fopencookie@@GLIBC_2.2.5
__ctype32_toupper@GLIBC_2.2.5
sched_getaffinity@@GLIBC_2.3.4
_dl_argv@@GLIBC_PRIVATE
posix_spawnp@GLIBC_2.2.5
getrpcent_r@@GLIBC_2.2.5
getprotobynumber_r@@GLIBC_2.2.5
_IO_file_close_it@@GLIBC_2.2.5
_obstack@GLIBC_2.2.5
[root@c9 opt]# ldd --version
ldd (GNU libc) 2.17
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Roland McGrath and Ulrich Drepper.

升级GCC/MAKE/glibc版本:

#升级GCC
yum install centos-release-scl -y 
yum install devtoolset-8-gcc devtoolset-8-gcc-c++ devtoolset-8-binutils devtoolset-8-toolchain -y 
scl enable devtoolset-8 bash
echo "source /opt/rh/devtoolset-8/enable" >> /etc/profile

##升级make
wget http://ftp.gnu.org/gnu/make/make-4.4.tar.gz
tar -xzvf make-4.4.tar.gz
cd make-4.4
./configure
make
make install
rm -rf /usr/bin/make
cp ./make /usr/bin/
make -v

##编译安装
yum install bison -y
wget https://ftp.gnu.org/gnu/glibc/glibc-2.28.tar.gz
tar zxf glibc-2.28.tar.gz 
cd glibc-2.28/
mkdir build
cd build/
../configure --prefix=/usr --disable-profile --enable-add-ons --with-headers=/usr/include --with-binutils=/usr/bin
make
make install

查看升级后的版本:

[root@c9 ~]# gcc --version
gcc (GCC) 8.3.1 20190311 (Red Hat 8.3.1-3)
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

[root@c9 ~]# ldd --version
ldd (GNU libc) 2.28
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Roland McGrath and Ulrich Drepper.

[root@c9 ~]# make -v
GNU Make 4.2.1
Built for x86_64-redhat-linux-gnu
Copyright (C) 1988-2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

最后初始化即可,如遇到各种lib库缺少建议安装Development Tools:

yum groupinstall "Development Tools" -y
yum install libtool-ltdl-devel -y #此为本次实验中机器缺少的包

附因缺少libncurses和libtinfo的问题处理:

[root@c9 ~]# mysql -uroot -p
mysql: error while loading shared libraries: libncurses.so.6: cannot open shared object file: No such file or directory

解决:

[root@c9 ~]# find / -name libncurses*
/usr/lib64/libncurses++.so.5
/usr/lib64/libncurses++.so.5.9
/usr/lib64/libncurses++w.so.5
/usr/lib64/libncurses++w.so.5.9
/usr/lib64/libncurses.so.5
/usr/lib64/libncurses.so.5.9
/usr/lib64/libncursesw.so.5
/usr/lib64/libncursesw.so.5.9
/usr/lib64/libncurses++w.so
/usr/lib64/libncurses++.so
/usr/lib64/libncurses.so
/usr/lib64/libncursesw.so
#做个软连接:
[root@c9 ~]# ln -s /usr/lib64/libncurses.so.5 /usr/lib64/libncurses.so.6

#libtinfo版本不对:
[root@c9]# mysql -uroot -p
mysql: error while loading shared libraries: libtinfo.so.6: cannot open shared object file: No such file or directory
[root@c9 ~]# find / -name libtinfo*
/usr/lib64/libtinfo.so.5
/usr/lib64/libtinfo.so.5.9
/usr/lib64/libtinfo.so
#做个软连接
[root@c9 ~]# ln -s /usr/lib64/libtinfo.so.5 /usr/lib64/libtinfo.so.6

按正常初始化MySQL加服务配置文件等常规操作过程省略
最后就可以登录MySQL8.1了:

[root@c9 ~]# cat /etc/redhat-release
CentOS Linux release 7.9.2009 (Core)

[root@c9 ~]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.1.0 MySQL Community Server - GPL

Copyright (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.

root@devops_db 11:13:  [(none)]> \s
--------------
mysql  Ver 8.1.0 for Linux on x86_64 (MySQL Community Server - GPL)

Connection id:          8
Current database:
Current user:           root@localhost
SSL:                    Not in use
Current pager:          stdout
Using outfile:          ''
Using delimiter:        ;
Server version:         8.1.0 MySQL Community Server - GPL
Protocol version:       10
Connection:             Localhost via UNIX socket
Server characterset:    utf8mb4
Db     characterset:    utf8mb4
Client characterset:    utf8mb4
Conn.  characterset:    utf8mb4
UNIX socket:            /data/mysql/mysql.sock
Uptime:                 9 min 47 sec

Threads: 2  Questions: 7  Slow queries: 0  Opens: 1292  Flush tables: 3  Open tables: 17  Queries per second avg: 0.011


相关博文:

发表新评论