实际上就是安装MySQL的client即可。
网上直接yum install mysql-client肯定是不行的。
参照:https://blog.csdn.net/zp8126/article/details/137084854
上面文章是安装的MySQL server,但是我们是安client,具体步骤如下:
wget http://dev.mysql.com/get/mysql80-community-release-el7-8.noarch.rpm
下一步:
yum install -y mysql-community-client --skip-broken --nogpgcheck
[root@ecm-be41 bin]# rpm -qa |grep mysql
mysql-community-client-plugins-8.0.36-1.el7.x86_64
mysql-community-common-8.0.36-1.el7.x86_64
mysql-community-libs-8.0.36-1.el7.x86_64
mysql-community-client-8.0.36-1.el7.x86_64
mysql80-community-release-el7-8.noarch
mysql-community-libs-compat-8.0.36-1.el7.x86_64
[root@ecm-be41 bin]# mysqldump
Usage: mysqldump [OPTIONS] database [tables]
OR mysqldump [OPTIONS] --databases [OPTIONS] DB1 [DB2 DB3...]
OR mysqldump [OPTIONS] --all-databases [OPTIONS]
For more options, use mysqldump --help
[root@ecm-be41 bin]#
没有这个参数的话,会报错:
Error: Package: mysql-community-client-8.0.36-1.el9.x86_64 (/mysql-community-client-8.0.36-1.el9.x86_64)
Requires: libstdc++.so.6(GLIBCXX_3.4.20)(64bit)
Error: Package: mysql-community-client-8.0.36-1.el9.x86_64 (/mysql-community-client-8.0.36-1.el9.x86_64)
Requires: libc.so.6(GLIBC_2.33)(64bit)
You could try using --skip-broken to work around the problem
** Found 2 pre-existing rpmdb problem(s), 'yum check' output follows:
ctcss-agent-3.5.5-1.el8.x86_64 is a duplicate with ctcss-agent-3.4.5-1.el7.x86_64
ctcss-agent-3.7.4-1.el7.x86_64 is a duplicate with ctcss-agent-3.5.5-1.el8.x86_64
没有第二个参数,--nogpgcheck,会报错:
Downloading packages:
warning: /var/cache/yum/x86_64/7/mysql80-community/packages/mysql-community-client-plugins-8.0.36-1.el7.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID a8d3785c: NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2022
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
The GPG keys listed for the "MySQL 8.0 Community Server" repository are already installed but they are not correct for this package.
Check that the correct key URLs are configured for this repository.
Failing package is: mysql-community-client-plugins-8.0.36-1.el7.x86_64
GPG Keys are configured as: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2022, file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql