错误如下:

root@solaris:/usr/local/mysql# /usr/local/mysql/bin/mysqld --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --initialize
ld.so.1: mysql: fatal: libCrunG3.so.1: open failed: No such file or directory
Killed

ldd命令查看mysqld执行所需要的库文件

root@solaris:/usr/local/mysql# ldd /usr/local/mysql/bin/mysqld
        libstdc++.so.6 =>        /usr/lib/64/libstdc++.so.6
        libstdc++.so.6 (GLIBCXX_3.4.20) =>       (version not found)
        libgcc_s.so.1 =>         /usr/lib/64/libgcc_s.so.1
        libCrunG3.so.1 =>        (file not found)
        libc.so.1 =>     /lib/64/libc.so.1
        libmtmalloc.so.1 =>      /usr/lib/64/libmtmalloc.so.1
        libsocket.so.1 =>        /lib/64/libsocket.so.1
        libnsl.so.1 =>   /lib/64/libnsl.so.1
        libm.so.2 =>     /lib/64/libm.so.2
        librt.so.1 =>    /lib/64/librt.so.1
        libatomic.so.1 =>        /usr/lib/64/libatomic.so.1
        libmp.so.2 =>    /lib/64/libmp.so.2
        libucrypto.so.1 =>       /lib/64/libucrypto.so.1
        libpthread.so.1 =>       /lib/64/libpthread.so.1
        libelf.so.1 =>   /lib/64/libelf.so.1
        libcryptoutil.so.1 =>    /lib/64/libcryptoutil.so.1
        libz.so.1 =>     /lib/64/libz.so.1

可以看到Solaris11.3中libstdc++.so.6是一个link文件

ls -l /usr/lib/64/libstdc++.so.6
lrwxrwxrwx   1 root     root          19 Oct 17 17:45 /usr/lib/64/libstdc++.so.6 -> libstdc++.so.6.0.18

这个问题我也卡了很久,没找到有效资料,string libstdc++.so.6.0.18 | grep GLIBCXX 这条命令并不适用Solaris11.3

可以用pvs命令查看库文件

root@solaris:/usr/local/mysql# pvs /usr/lib/64/libstdc++.so.6.0.18 
        libm.so.2 (SUNW_1.2);
        libc.so.1 (SUNW_1.22, SUNWprivate_1.1);
        libgcc_s.so.1 (GCC_4.2.0);
        libstdc++.so.6;
        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;
        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;

可以看到确实没有GLIBCXX_3.4.20版本

解决办法:
编译安装gcc4.9,过程就不在这里写了,我直接用的原来编译好的tar包,然后用gcc里面的库文件代替libstdc++.so.6.0.18,过程如下

root@solaris:~# mkdir /usr/gcc
root@solaris:~# tar -xf gcc4.9.tar.gz 
root@solaris:~# mv 4.9 /usr/gcc/
root@solaris:~# mv /usr/lib/64/libstdc++.so.6 /usr/lib/64/libstdc++.so.6.bak
root@solaris:~# ln -s /usr/gcc/4.9/lib/amd64/libstdc++.so.6.0.20 /usr/lib/64/libstdc++.so.6

此时ldd查看

root@solaris:/usr/local/mysql# ldd ./bin/mysqld
        libstdc++.so.6 =>        /usr/lib/64/libstdc++.so.6
        libgcc_s.so.1 =>         /usr/lib/64/libgcc_s.so.1
        libCrunG3.so.1 =>        (file not found)
        libc.so.1 =>     /lib/64/libc.so.1
        libmtmalloc.so.1 =>      /usr/lib/64/libmtmalloc.so.1
        libsocket.so.1 =>        /lib/64/libsocket.so.1
        libnsl.so.1 =>   /lib/64/libnsl.so.1
        libm.so.2 =>     /lib/64/libm.so.2
        librt.so.1 =>    /lib/64/librt.so.1
        libatomic.so.1 =>        /usr/lib/64/libatomic.so.1
        libpthread.so.1 =>       /lib/64/libpthread.so.1
        libmp.so.2 =>    /lib/64/libmp.so.2
        libucrypto.so.1 =>       /lib/64/libucrypto.so.1
        libelf.so.1 =>   /lib/64/libelf.so.1
        libcryptoutil.so.1 =>    /lib/64/libcryptoutil.so.1
        libz.so.1 =>     /lib/64/libz.so.1

GLIBCXX的问题解决了,但是又提示libCrunG3.so.1找不到,把文件拷贝到/usr/lib/64/下

root@solaris:/usr/local/mysql# cp /root/libCrunG3.so.1  /usr/lib/64/

此时ldd mysqld已经没有报错,可以开始初始化

root@solaris:~# /usr/local/mysql/bin/mysqld --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --initialize
2018-10-17T10:41:29.143880Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-10-17T10:41:34.828810Z 0 [Warning] InnoDB: New log files created, LSN=45790
2018-10-17T10:41:35.756604Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2018-10-17T10:41:35.840912Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 386b2928-d1f9-11e8-9e9b-9e1aa5f0c1f7.
2018-10-17T10:41:35.843805Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2018-10-17T10:41:35.845870Z 1 [Note] A temporary password is generated for root@localhost: L9!TrOyPaiiS


root@solaris:/usr/local/mysql# ./support-files/mysql.server start 
Starting MySQL
.Logging to '/usr/local/mysql/data/solaris.err'.
. SUCCESS!

root@solaris:/usr/local/mysql# /usr/local/mysql/bin/mysql -uroot -p'L9!TrOyPaiiS'
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.23

Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

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> 

启动过程可能还会遇到其他问题,这里就不写了


CastlePeak
17 声望0 粉丝