一.环境准备

环境: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的版本。

CentOS7上安装PXC_第1张图片
安装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

安装到此结束