CentOS7上安裝PXC

一.環境準備

環境:vm虛擬機器,
系統:centos7

[root@mgr01 mysql3308]# cat /etc/redhat-release 
CentOS Linux release 7.2.1511 (Core)

關閉iptables,firewalld 和selinux,3臺服務器保證時間同步

集羣名 pxc-test
節點1  10.0.0.6
節點2  10.0.0.7
節點3  10.0.0.8
修改主機名:
[root@pcx01 ~]# cat /etc/hostname 
pxc01
[root@pxc02 ~]# cat /etc/hostname 
pxc02
[root@pxc03 ~]# cat /etc/hostname 
pxc03
本地host文件解析:
[root@pcx01 ~]# cat /etc/hosts
10.0.0.6 pxc01
10.0.0.7 pxc02
10.0.0.131 pxc03

二、mysql-pxc介紹

2.1安裝包下載介紹:

下載包說明:

https://www.percona.com/downloads/Percona-XtraDB-Cluster-LATEST/
一般是根據服務器上openssl的版本來選擇對應的二進制安裝包版本的

[root@pcx01 ~]# rpm -qa|grep openssl
openssl-libs-1.0.2k-16.el7.x86_64
openssl-1.0.2k-16.el7.x86_64
openssl-devel-1.0.2k-16.el7.x86_64
openssl098e-0.9.8e-29.el7.centos.2.x86_64

根據服務器上的openssl版本來選擇1.0.2的版本。

<br/>
安裝mysql-pxc實例
節點1 10.0.0.6安裝mysql-pxc實例

官方下載地址:
https://www.percona.com/downloads/Percona-XtraDB-Cluster-LATEST/

版本安裝錯了,要解決一堆的版本兼容問題

2.2安裝過程:

下載鏈接:

https://www.percona.com/downloads/Percona-XtraDB-Cluster-LATEST/Percona-XtraDB-Cluster-5.7.22-29.26/binary/tarball/Percona-XtraDB-Cluster-5.7.22-rel22-29.26.1.Linux.x86_64.ssl102.tar.gz

解壓:

[root@pcx01 ~]# tar xf Percona-XtraDB-Cluster-5.7.24-rel26-31.33.1.Linux.x86_64.ssl102.tar.gz -C /usr/local/
[root@pcx01 local]# mv Percona-XtraDB-Cluster-5.7.24-rel26-31.33.1.Linux.x86_64.ssl102 mysqlpxc

查看安裝mysql時是否缺少相關的依賴:

[root@pcx01 local]# ldd /usr/local/mysqlpxc/bin/mysqld
/usr/local/mysqlp/bin/mysqld: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /usr/local/mysqlp/bin/mysqld)
/usr/local/mysqlp/bin/mysqld: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/local/mysqlp/bin/mysqld)
    linux-vdso.so.1 =>  (0x00007ffdcd57e000)
    libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f788de99000)
    libaio.so.1 => /lib64/libaio.so.1 (0x00007f788dc97000)
    libnuma.so.1 => /lib64/libnuma.so.1 (0x00007f788da8a000)
    libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00007f788d853000)
    libssl.so.1.1 => not found
    libcrypto.so.1.1 => not found
    libdl.so.2 => /lib64/libdl.so.2 (0x00007f788d64e000)
    libz.so.1 => /lib64/libz.so.1 (0x00007f788d438000)
    librt.so.1 => /lib64/librt.so.1 (0x00007f788d22f000)
    libatomic.so.1 => not found
    libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007f788cf27000)
    libm.so.6 => /lib64/libm.so.6 (0x00007f788cc24000)
    libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f788ca0e000)
    libc.so.6 => /lib64/libc.so.6 (0x00007f788c64d000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f788fd9f000)
    libfreebl3.so => /lib64/libfreebl3.so (0x00007f788c449000)
You have new mail in /var/spool/mail/root
[root@pcx01 local]#

也就是下面的not found :

[root@pxc01 local]#  ldd /usr/local/mysqlpxc/bin/mysqld|grep 'not found'
/usr/local/mysqlpxc/bin/mysqld: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /usr/local/mysqlpxc/bin/mysqld)
/usr/local/mysqlpxc/bin/mysqld: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/local/mysqlpxc/bin/mysqld)
    libssl.so.1.1 => not found
    libcrypto.so.1.1 => not found
    libatomic.so.1 => not found
[root@pxc01 local]#

查看當前服務器上GLIBCXX存在的版本,發現確實不存在_3.4.21和_3.4.20版本

[root@pcx01 local]# strings /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

解決辦法:
參考文檔:
https://www.cnblogs.com/litifeng/p/8492251.html

1、下載gcc: wget http://ftp.gnu.org/gnu/gcc/gcc-7.3.0/gcc-7.3.0.tar.xz
2、解壓gcc:
yum -y install xz
3、編譯安裝:
tar -xf gcc-7.3.0.tar.xz -C /root
cd /root/gcc-7.3.0
安裝gcc的依賴軟件,gcc的軟件包內提供了自動下載需要軟件的腳本:

root@pxc01 gcc-7.3.0]# ./contrib/download_prerequisites
2019-02-24 05:35:29 URL: ftp://gcc.gnu.org/pub/gcc/infrastructure/gmp-6.1.0.tar.bz2 [2383840] -> "./gmp-6.1.0.tar.bz2" [1]
2019-02-24 05:35:33 URL: ftp://gcc.gnu.org/pub/gcc/infrastructure/mpfr-3.1.4.tar.bz2 [1279284] -> "./mpfr-3.1.4.tar.bz2" [1]
2019-02-24 05:35:42 URL: ftp://gcc.gnu.org/pub/gcc/infrastructure/mpc-1.0.3.tar.gz [669925] -> "./mpc-1.0.3.tar.gz" [1]
2019-02-24 05:35:58 URL: ftp://gcc.gnu.org/pub/gcc/infrastructure/isl-0.16.1.tar.bz2 [1626446] -> "./isl-0.16.1.tar.bz2" [1]
gmp-6.1.0.tar.bz2: OK
mpfr-3.1.4.tar.bz2: OK
mpc-1.0.3.tar.gz: OK
isl-0.16.1.tar.bz2: OK
All prerequisites downloaded successfully.
[root@pxc01 gcc-7.3.0]#

4.編譯gcc:

./configure -enable-checking=release -enable-languages=c,c++ -disable-multilib
 echo $?

make //多核電腦可以添加 “-j4” :make對多核處理器的優化選項,此步驟非常耗時
make install

...................................................
....................................................
make[3]: Leaving directory `/root/gcc-7.3.0/x86_64-pc-linux-gnu/libquadmath'
make[2]: Leaving directory `/root/gcc-7.3.0/x86_64-pc-linux-gnu/libquadmath'
Checking multilib configuration for libitm...
make[2]: Entering directory `/root/gcc-7.3.0/x86_64-pc-linux-gnu/libitm'
make  all-recursive
make[3]: Entering directory `/root/gcc-7.3.0/x86_64-pc-linux-gnu/libitm'
Making all in testsuite
make[4]: Entering directory `/root/gcc-7.3.0/x86_64-pc-linux-gnu/libitm/testsuite'
make[4]: Nothing to be done for `all'.
make[4]: Leaving directory `/root/gcc-7.3.0/x86_64-pc-linux-gnu/libitm/testsuite'
make[4]: Entering directory `/root/gcc-7.3.0/x86_64-pc-linux-gnu/libitm'
true  DO=all multi-do # make
make[4]: Leaving directory `/root/gcc-7.3.0/x86_64-pc-linux-gnu/libitm'
make[3]: Leaving directory `/root/gcc-7.3.0/x86_64-pc-linux-gnu/libitm'
make[2]: Leaving directory `/root/gcc-7.3.0/x86_64-pc-linux-gnu/libitm'
Checking multilib configuration for libatomic...
make[2]: Entering directory `/root/gcc-7.3.0/x86_64-pc-linux-gnu/libatomic'
make  all-recursive
make[3]: Entering directory `/root/gcc-7.3.0/x86_64-pc-linux-gnu/libatomic'
Making all in testsuite
make[4]: Entering directory `/root/gcc-7.3.0/x86_64-pc-linux-gnu/libatomic/testsuite'
make[4]: Nothing to be done for `all'.
make[4]: Leaving directory `/root/gcc-7.3.0/x86_64-pc-linux-gnu/libatomic/testsuite'
make[4]: Entering directory `/root/gcc-7.3.0/x86_64-pc-linux-gnu/libatomic'
true  DO=all multi-do # make
make[4]: Leaving directory `/root/gcc-7.3.0/x86_64-pc-linux-gnu/libatomic'
make[3]: Leaving directory `/root/gcc-7.3.0/x86_64-pc-linux-gnu/libatomic'
make[2]: Leaving directory `/root/gcc-7.3.0/x86_64-pc-linux-gnu/libatomic'
make[1]: Leaving directory `/root/gcc-7.3.0'
[root@pxc02 gcc-7.3.0]# 
[root@pxc02 gcc-7.3.0]# echo $?
0

ls /usr/local/bin | grep gcc
5.配置gcc:

[root@pxc01 ~]# find /root/gcc-7.3.0/ -name "libstdc++.so*"
/root/gcc-7.3.0/x86_64-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6.0.24
/root/gcc-7.3.0/x86_64-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6
/root/gcc-7.3.0/x86_64-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so
/root/gcc-7.3.0/prev-x86_64-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6.0.24
/root/gcc-7.3.0/prev-x86_64-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6
/root/gcc-7.3.0/prev-x86_64-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so
/root/gcc-7.3.0/stage1-x86_64-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6.0.24
/root/gcc-7.3.0/stage1-x86_64-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6
/root/gcc-7.3.0/stage1-x86_64-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so
cd /usr/lib64
cp /root/gcc-7.3.0/stage1-x86_64-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6.0.24  ./

mv libstdc++.so.6 libstdc++.so.6.old
[root@pxc02 lib64]# cp /root/gcc-7.3.0/stage1-x86_64-pc-linux-gnu/libstdc++-v3/src/.libs/libstdc++.so.6.0.24  ./
[root@pxc02 lib64]# mv libstdc++.so.6 libstdc++.so.6.old
[root@pxc02 lib64]# ln -sv libstdc++.so.6.0.24 libstdc++.so.6
‘libstdc++.so.6’ -> ‘libstdc++.so.6.0.24’
[root@pxc02 lib64]# ll libstdc++.so.6
lrwxrwxrwx 1 root root 19 Feb 24 02:22 libstdc++.so.6 -> libstdc++.so.6.0.24
[root@pxc02 lib64]# 
[root@pxc02 ~]# strings /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_3.4.20
GLIBCXX_3.4.21
GLIBCXX_3.4.22
GLIBCXX_3.4.23
GLIBCXX_3.4.24
GLIBCXX_DEBUG_MESSAGE_LENGTH

正常了

繼續查看缺少的依賴庫文件:

[root@pxc01 local]#  ldd /usr/local/mysqlpxc/bin/mysqld|grep 'not found'
    libssl.so.1.1 => not found
    libcrypto.so.1.1 => not found
    libatomic.so.1 => not found
[root@pxc01 local]#

解決上面的這2個問題:

libssl.so.1.1 => not found
    libcrypto.so.1.1 => not found
openssl version -a
OpenSSL 1.0.2k-fips  26 Jan 2017
mv /usr/bin/openssl /usr/bin/openssl.bak 
[root@pxc01 ~]# ll  /usr/local/bin/openssl
-rwxr-xr-x 1 root root 672829 Feb 24 05:19 /usr/local/bin/openssl
[root@pxc01 ~]#
[root@pxc01 ~]#cp /usr/local/bin/openssl /usr/bin/
[root@pxc01 ~]# ll /usr/local/lib64/libssl.so.1.1
-rwxr-xr-x 1 root root 520910 Feb 24 05:19 /usr/local/lib64/libssl.so.1.1
[root@pxc01 ~]# ll /usr/local/lib64/libcrypto.so.1.1
-rwxr-xr-x 1 root root 2929061 Feb 24 05:19 /usr/local/lib64/libcrypto.so.1.1
[root@pxc01 ~]#
[root@pxc01 ~]# ln -s /usr/local/lib64/libssl.so.1.1 /usr/lib64/libssl.so.1.1
[root@pxc01 ~]# ln -s /usr/local/lib64/libcrypto.so.1.1 /usr/lib64/libcrypto.so.1.1
[root@pxc01 ~]#  openssl version -a
OpenSSL 1.1.0c  10 Nov 2016
built on: reproducible build, date unspecified
platform: linux-x86_64
compiler: gcc -DZLIB -DDSO_DLFCN -DHAVE_DLFCN_H -DNDEBUG -DOPENSSL_THREADS -DOPENSSL_NO_STATIC_ENGINE -DOPENSSL_PIC -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DRC4_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DPOLY1305_ASM -DOPENSSLDIR="\"/usr/local/ssl\"" -DENGINESDIR="\"/usr/local/lib64/engines-1.1\""  -Wa,--noexecstack
OPENSSLDIR: "/usr/local/ssl"
ENGINESDIR: "/usr/local/lib64/engines-1.1"
[root@pxc01 ~]#

解決這個問題:
libatomic.so.1 => not found

yum install libatomic* -y

檢查mysql 的依賴庫:一切正常


[root@pxc02 local]# ldd /usr/local/mysqlpxc/bin/mysqld
    linux-vdso.so.1 =>  (0x00007ffc1f18a000)
    libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f11a3a3f000)
    libaio.so.1 => /lib64/libaio.so.1 (0x00007f11a383d000)
    libnuma.so.1 => /lib64/libnuma.so.1 (0x00007f11a3630000)
    libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00007f11a33f9000)
    libssl.so.1.1 => /lib64/libssl.so.1.1 (0x00007f11a318b000)
    libcrypto.so.1.1 => /lib64/libcrypto.so.1.1 (0x00007f11a2d07000)
    libdl.so.2 => /lib64/libdl.so.2 (0x00007f11a2b03000)
    libz.so.1 => /lib64/libz.so.1 (0x00007f11a28ed000)
    librt.so.1 => /lib64/librt.so.1 (0x00007f11a26e4000)
    libatomic.so.1 => /lib64/libatomic.so.1 (0x00007f11a24dc000)
    libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007f11a215a000)
    libm.so.6 => /lib64/libm.so.6 (0x00007f11a1e57000)
    libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f11a1c41000)
    libc.so.6 => /lib64/libc.so.6 (0x00007f11a1880000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f11a5945000)
    libfreebl3.so => /lib64/libfreebl3.so (0x00007f11a167c000)
[root@pxc02 local]# 

3.初始化mysql-pxc

[root@pxc01 mysql3306]# /usr/local/mysqlpxc/bin/mysqld --defaults-file=/data/mysql/mysql3306/my3306.cnf  --initialize 
[root@pxc01 mysql3306]# 

生產臨時密碼:

[root@pxc01 logs]# grep temporary  /data/mysql/mysql3306/logs/error.log
2019-02-24T17:07:47.224848+08:00 1 [Note] A temporary password is generated for root@localhost: )rlngyf%#2cS
[root@pxc01 logs]# 

啓動pxc集羣的第一個節點:啓動第一個節點必須帶參數--wsrep-new-cluster,其他節點啓動不需要帶

/usr/local/mysqlpxc/bin/mysqld_safe --defaults-file=/data/mysql/mysql3308/my3308.cnf --wsrep-new-cluster &
或者:
/usr/local/mysqlpxc/bin/mysqld --defaults-file=/data/mysql/mysql3308/my3308.cnf  &
[root@pxc01 logs]# /usr/local/mysqlpxc/bin/mysqld_safe --defaults-file=/data/mysql/mysql3308/my3308.cnf --wsrep-new-cluster &
[1] 7262
You have new mail in /var/spool/mail/root
[root@pxc01 logs]# 
[root@pxc01 logs]# 2019-02-24T09:14:15.111926Z mysqld_safe Logging to '/data/mysql/mysql3308/logs/error.log'.
2019-02-24T09:14:15.134183Z mysqld_safe Logging to '/data/mysql/mysql3308/logs/error.log'.
2019-02-24T09:14:15.215383Z mysqld_safe Starting mysqld daemon with databases from /data/mysql/mysql3308/data
2019-02-24T09:14:15.245022Z mysqld_safe Skipping wsrep-recover for empty datadir: /data/mysql/mysql3308/data
2019-02-24T09:14:15.272304Z mysqld_safe Assigning 00000000-0000-0000-0000-000000000000:-1 to wsrep_start_position

[root@pxc01 logs]# 

[root@pxc01 logs]# ss -lntup|grep mysql
tcp    LISTEN     0      128       *:4567                  *:*                   users:(("mysqld",pid=8516,fd=11))
tcp    LISTEN     0      128      :::3306                 :::*                   users:(("mysqld",pid=8516,fd=33))
[root@pxc01 logs]# 

登錄pxc mysql 報錯:

[root@pxc01 data]# /usr/local/mysqlpxc/bin/mysql -uroot -p
/usr/local/mysqlpxc/bin/mysql: error while loading shared libraries: libreadline.so.7: cannot open shared object file: No such file or directory

查看找不到的庫文件:

[root@pxc01 mysql3308]# ldd /usr/local/mysqlpxc/bin/mysql|grep 'not found'
    libreadline.so.7 => not found

提示缺少庫文件,解決辦法:

libreadline.so.7 => not found

到下面的地址查找安裝libreadline.so.7 庫文件所需要的rpm包

http://rpmfind.net/linux/rpm2html/search.php?query=libreadline.so.7&submit=Search+...&system=&arch=
[root@pxc01 ~]# wget https://rpmfind.net/linux/fedora/linux/releases/27/Everything/x86_64/os/Packages/r/readline-7.0-7.fc27.i686.rpm
--2019-02-24 18:19:24--  https://rpmfind.net/linux/fedora/linux/releases/27/Everything/x86_64/os/Packages/r/readline-7.0-7.fc27.i686.rpm
Resolving rpmfind.net (rpmfind.net)... 195.220.108.108
Connecting to rpmfind.net (rpmfind.net)|195.220.108.108|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 223678 (218K) [application/x-rpm]
Saving to: ‘readline-7.0-7.fc27.i686.rpm’

100%[======================================================================================================================================================================================>] 223,678      122KB/s   in 1.8s   

2019-02-24 18:19:27 (122 KB/s) - ‘readline-7.0-7.fc27.i686.rpm’ saved [223678/223678]

[root@pxc01 ~]# rpm -ivh readline-7.0-7.fc27.i686.rpm 
warning: readline-7.0-7.fc27.i686.rpm: Header V3 RSA/SHA256 Signature, key ID f5282ee4: NOKEY
error: Failed dependencies:
    libtinfo.so.6 is needed by readline-7.0-7.fc27.i686

    查找當前的庫文件:
[root@pxc01 ~]# find / -name 'libtinfo.so.*'
/usr/lib64/libtinfo.so.5
/usr/lib64/libtinfo.so.5.9

查找庫文件libtinfo.so.6 所需要安裝的rpm包:

查看地址:http://rpmfind.net/linux/rpm2html/search.php?query=libtinfo.so.6
找到相應的庫文件並下載
wget http://rpmfind.net/linux/fedora/linux/releases/27/Everything/x86_64/os/Packages/n/ncurses-libs-6.0-13.20170722.fc27.i686.rpm

安裝報錯如下:

[root@pxc01 ~]# rpm -ivh ncurses-libs-6.0-13.20170722.fc27.i686.rpm
warning: ncurses-libs-6.0-13.20170722.fc27.i686.rpm: Header V3 RSA/SHA256 Signature, key ID f5282ee4: NOKEY
error: Failed dependencies:
    ncurses-base = 6.0-13.20170722.fc27 is needed by ncurses-libs-6.0-13.20170722.fc27.i686

於是查找庫文件ncurses-base:

http://rpmfind.net/linux/rpm2html/search.php?query=ncurses-base&submit=Search+...&system=&arch=

找到對應的版本下載:

    [root@pxc01 ~]# wget http://rpmfind.net/linux/fedora/linux/releases/27/Everything/x86_64/os/Packages/n/ncurses-base-6.0-13.20170722.fc27.noarch.rpm
--2019-02-24 18:51:45--  http://rpmfind.net/linux/fedora/linux/releases/27/Everything/x86_64/os/Packages/n/ncurses-base-6.0-13.20170722.fc27.noarch.rpm
Resolving rpmfind.net (rpmfind.net)... 195.220.108.108
Connecting to rpmfind.net (rpmfind.net)|195.220.108.108|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 78838 (77K) [application/x-rpm]
Saving to: ‘ncurses-base-6.0-13.20170722.fc27.noarch.rpm’

100%[======================================================================================================================================================================================>] 78,838      98.9KB/s   in 0.8s   

2019-02-24 18:51:46 (98.9 KB/s) - ‘ncurses-base-6.0-13.20170722.fc27.noarch.rpm’ saved [78838/78838]

安裝新版本的:ncurses-base-6.0-13.20170722.fc27.noarch.rpm

[root@pxc01 ~]# rpm -ivh ncurses-base-6.0-13.20170722.fc27.noarch.rpm
warning: ncurses-base-6.0-13.20170722.fc27.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID f5282ee4: NOKEY
Preparing...                          ################################# [100%]
    file /usr/share/terminfo/v/vt100 from install of ncurses-base-6.0-13.20170722.fc27.noarch conflicts with file from package ncurses-base-5.9-14.20130511.el7_4.noarch
    file /usr/share/terminfo/A/Apple_Terminal from install of ncurses-base-6.0-13.20170722.fc27.noarch conflicts with file from package ncurses-base-5.9-14.20130511.el7_4.noarch

提示和服務器上的舊版本衝突 ,於是卸載掉老版本:ncurses-base-5.9-14.20130511.el7_4

[root@pxc01 ~]# rpm -qa|grep ncurses-base*
ncurses-base-5.9-14.20130511.el7_4.noarch
卸載:
root@pxc01 ~]# rpm -e --nodeps ncurses-base-5.9-14.20130511.el7_4
[root@pxc01 ~]# 
再次安裝:
[root@pxc01 ~]# rpm -ivh ncurses-base-6.0-13.20170722.fc27.noarch.rpm
warning: ncurses-base-6.0-13.20170722.fc27.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID f5282ee4: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:ncurses-base-6.0-13.20170722.fc27################################# [100%]
You have new mail in /var/spool/mail/root

安裝ncurses-libs-6.0-13.20170722.fc27.i686.rpm:

[root@pxc01 ~]# rpm -ivh ncurses-libs-6.0-13.20170722.fc27.i686.rpm
warning: ncurses-libs-6.0-13.20170722.fc27.i686.rpm: Header V3 RSA/SHA256 Signature, key ID f5282ee4: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:ncurses-libs-6.0-13.20170722.fc27################################# [100%]
[root@pxc01 ~]# rpm 

[root@pxc01 ~]# find / -name "libtinfo.so*"
/usr/lib/libtinfo.so.6.0
/usr/lib/libtinfo.so.6
/usr/lib64/libtinfo.so.5
/usr/lib64/libtinfo.so.5.9
[root@pxc01 ~]# 
[root@pxc01 lib64]# ln -sv /usr/lib/libtinfo.so.6.0 /usr/lib64/libtinfo.so.6
‘/usr/lib64/libtinfo.so.6’ -> ‘/usr/lib/libtinfo.so.6.0’
[root@pxc01 lib64]# ll libtinfo.so.6
lrwxrwxrwx 1 root root 24 Feb 24 19:37 libtinfo.so.6 -> /usr/lib/libtinfo.so.6.0
[root@pxc01 lib64]# 

最後安裝提示衝突:

[root@pxc01 ~]# rpm -ivh readline-7.0-7.fc27.i686.rpm 
warning: readline-7.0-7.fc27.i686.rpm: Header V3 RSA/SHA256 Signature, key ID f5282ee4: NOKEY
Preparing...                          ################################# [100%]
    file /usr/share/info/history.info.gz from install of readline-7.0-7.fc27.i686 conflicts with file from package readline-6.2-10.el7.x86_64
    file /usr/share/info/rluserman.info.gz from install of readline-7.0-7.fc27.i686 conflicts with file from package readline-6.2-10.el7.x86_64
[root@pxc01 ~]# 

卸載掉readline-6.2-10.el7.x86_64 重新安裝(此處卸載了它,才導致後面登錄mysqlpxc實例報錯找不到libreadline.so.6)

[root@pxc01 ~]# rpm -qa|grep readline-6.2-10.el7.x86_64
readline-6.2-10.el7.x86_64
[root@pxc01 ~]# rpm -e --nodeps readline-6.2-10.el7.x86_64 
[root@pxc01 ~]# rpm -qa|grep readline-6.2-10.el7.x86_64
[root@pxc01 ~]# rpm -ivh readline-7.0-7.fc27.i686.rpm 
warning: readline-7.0-7.fc27.i686.rpm: Header V3 RSA/SHA256 Signature, key ID f5282ee4: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:readline-7.0-7.fc27              ################################# [100%]
[root@pxc01 ~]# 
[root@pxc01 ~]# find / -name 'libreadline.so*'
/usr/lib/libreadline.so.7.0
/usr/lib/libreadline.so.7
[root@pxc01 ~]# ln -sv /usr/lib/libreadline.so.7.0  /lib64/libreadline.so.7
‘/lib64/libreadline.so.7’ -> ‘/usr/lib/libreadline.so.7.0’
[root@pxc01 ~]# ll /lib64/libreadline.so.7
lrwxrwxrwx 1 root root 27 Feb 24 19:52 /lib64/libreadline.so.7 -> /usr/lib/libreadline.so.7.0
[root@pxc01 ~]# 

本以爲到此處問題終於解決了
但是[root@pxc01 ~]# ldd /usr/local/mysqlpxc/bin/mysql
linux-vdso.so.1 => (0x00007ffdd57fb000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f873f608000)
libreadline.so.7 => not found

看來不是他的問題,於是卸載掉安裝的文件:readline-7.0-7.fc27.i686.rpm
rpm -e --nodeps readline-7.0-7.fc27.i686

此時再次登錄mysqlpxc實例報錯找不到libreadline.so.6,這個就是剛纔卸載readline-6.2-10.el7.x86_64 導致的

[root@pxc01 local]# /usr/local/mysqlpxc/bin/mysql -uroot -p
mysql: error while loading shared libraries: libreadline.so.6: cannot open shared object file: No such file or directory
[root@pxc01 local]# ldd /usr/local/mysqlpxc/bin/mysql
ldd: ./mysql: not regular file
[root@pxc01 local]# ldd /usr/bin/mysql
    linux-vdso.so.1 =>  (0x00007ffd38da9000)
    libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f91bc012000)
    libreadline.so.6 => not found

繼續百度看到這個地址:
https://blog.51cto.com/10742668/1948451


 yum install -y readline-devel readline

[root@pxc01 local]# rpm -qa|grep readline*
readline-devel-6.2-10.el7.x86_64
readline-6.2-10.el7.x86_64
[root@pxc01 local]# ll /usr/lib64/libreadline.so*
lrwxrwxrwx 1 root root     28 Feb 24 20:58 /usr/lib64/libreadline.so -> ../../lib64/libreadline.so.6
lrwxrwxrwx 1 root root     18 Feb 24 20:58 /usr/lib64/libreadline.so.6 -> libreadline.so.6.2
-rwxr-xr-x 1 root root 285240 Aug  2  2017 /usr/lib64/libreadline.so.6.2
[root@pxc01 local]# find / -name 'libreadline.so*'
/usr/lib64/libreadline.so.6.2
/usr/lib64/libreadline.so
/usr/lib64/libreadline.so.6

[root@pxc01 local]# ldd /usr/local/mysqlpxc/bin/mysql 
    linux-vdso.so.1 =>  (0x00007ffd0a962000)
    libpthread.so.0 => /lib64/libpthread.so.0 (0x00007efdb1f80000)
    libreadline.so.6 => /lib64/libreadline.so.6 (0x00007efdb1d3a000)
    libncurses.so.5 => /lib64/libncurses.so.5 (0x00007efdb1b12000)
    libtinfo.so.5 => /lib64/libtinfo.so.5 (0x00007efdb18e8000)
    libz.so.1 => /lib64/libz.so.1 (0x00007efdb16d2000)
    librt.so.1 => /lib64/librt.so.1 (0x00007efdb14c9000)
    libssl.so.10 => /lib64/libssl.so.10 (0x00007efdb1257000)
    libcrypto.so.10 => /lib64/libcrypto.so.10 (0x00007efdb0df6000)
    libdl.so.2 => /lib64/libdl.so.2 (0x00007efdb0bf1000)
    libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007efdb086f000)
    libm.so.6 => /lib64/libm.so.6 (0x00007efdb056d000)
    libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007efdb0356000)
    libc.so.6 => /lib64/libc.so.6 (0x00007efdaff89000)
    /lib64/ld-linux-x86-64.so.2 (0x00007efdb21a5000)
    libgssapi_krb5.so.2 => /lib64/libgssapi_krb5.so.2 (0x00007efdafd3c000)
    libkrb5.so.3 => /lib64/libkrb5.so.3 (0x00007efdafa52000)
    libcom_err.so.2 => /lib64/libcom_err.so.2 (0x00007efdaf84e000)
    libk5crypto.so.3 => /lib64/libk5crypto.so.3 (0x00007efdaf633000)
    libkrb5support.so.0 => /lib64/libkrb5support.so.0 (0x00007efdaf423000)
    libkeyutils.so.1 => /lib64/libkeyutils.so.1 (0x00007efdaf21f000)
    libresolv.so.2 => /lib64/libresolv.so.2 (0x00007efdaf006000)
    libselinux.so.1 => /lib64/libselinux.so.1 (0x00007efdaedde000)
    libpcre.so.1 => /lib64/libpcre.so.1 (0x00007efdaeb7c000)
You have new mail in /var/spool/mail/root
[root@pxc01 local]# 

到此處不在報錯,問題得以解決。太鬱悶了。

[root@pxc01 mysql3308]# /usr/local/mysqlpxc/bin/mysql -uroot -p -S /tmp/mysql3308.sock
Enter password: 

(root@'mgr01':mysql3308.sock)[(none)]>alter user user() identified by '654321';
Query OK, 0 rows affected (0.06 sec)

(root@'mgr01':mysql3308.sock)[(none)]>\q
cp /usr/local/mysqlpxc/bin/mysql  /usr/bin/
[root@pxc01 ~]# which mysql
/usr/bin/mysql
[root@pxc01 ~]# cat .my.cnf 
[mysql]
user=root
password=654321
prompt="(\\u@\\'mgr01':\\p)[\\d]>"
[root@pxc01 ~]# 

[root@pxc01 ~]# mysql -S /tmp/mysql3308.sock

安裝到此結束

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章