目录
1、简介
2、将软件上传到指定的位置
3、安装
3.1、centos7中是有自带MySQL数据库的,我们首先得先卸载它
3.2、安装 mysql-community-common-8.0.33-1.el9.x86_64.rpm
3.3、安装mysql-community-client-plugins-8.0.33-1.el7.x86_64.rpm
3.4、安装 mysql-community-libs-5.7.26-1.el7.x86_64.rpm
3.5、安装mysql-community-client-8.0.33-1.el7.x86_64.rpm
4、验证MySQL的客户端是否安装成功
1、简介
背景:需要做一个这样的需求,Linux下通过MySQL的下面的命令,完成文件加载到另一个MySQL服务器的需求,命令如下:mysql -h172.18.22.100 -uroot -p’123!@#’ ,但是目前这个服务器上没有MySQL相应的组件,之前安装过MySQL的服务端和客户端,现在想着是不是只安装MySQL的客户端就够用了。这样也能节省系统开销,不需要安装服务端了
注意:安装客户端的话,只安装以下几个安装包就够用了(note:一定要按这个顺序来安装,否则会有报错的提示)
mysql-community-common-8.0.33-1.el7.x86_64.rpm
mysql-community-client-plugins-8.0.33-1.el7.x86_64.rpm
mysql-community-libs-8.0.33-1.el7.x86_64.rpm
mysql-community-client-8.0.33-1.el7.x86_64.rpm
下载client安装包地址如下:
MySQL :: Download MySQL Community Server (Archived Versions)https://downloads.mysql.com/archives/community/
2、将软件上传到指定的位置
3、安装
3.1、centos7中是有自带MySQL数据库的,我们首先得先卸载它
先查看是否有自带的数据库:
[root@localhost mysql-client]# ll
总用量 6032
-rwxr-xr-x. 1 root root 4061943 1月 26 14:25 mysql-community-client-8.0.33-1.el7.x86_64.rpm
-rwxr-xr-x. 1 root root 567595 1月 26 14:25 mysql-community-common-8.0.33-1.el7.x86_64.rpm
-rwxr-xr-x. 1 root root 1541256 1月 26 14:25 mysql-community-libs-8.0.33-1.el7.x86_64.rpm
[root@localhost mysql-client]# rpm -qa | grep mariadb
mariadb-libs-5.5.68-1.el7.x86_64
[root@localhost mysql-client]# rpm -e --nodeps mariadb-libs-5.5.68-1.el7.x86_64
[root@localhost mysql-client]# rpm -qa | grep mariadb
[root@localhost mysql-client]#
3.2、安装 mysql-community-common-8.0.33-1.el9.x86_64.rpm
rpm -ivh mysql-community-common-8.0.33-1.el7.x86_64.rpm //安装命令
[root@localhost mysql-client]# rpm -ivh mysql-community-common-8.0.33-1.el7.x86_64.rpm
警告:mysql-community-common-8.0.33-1.el7.x86_64.rpm: 头V4 RSA/SHA256 Signature, 密钥 ID 3a79bd29: NOKEY
准备中... ################################# [100%]
正在升级/安装...1:mysql-community-common-8.0.33-1.e################################# [100%]
[root@localhost mysql-client]#
3.3、安装mysql-community-client-plugins-8.0.33-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-plugins-8.0.33-1.el7.x86_64.rpm #安装命令
3.4、安装 mysql-community-libs-5.7.26-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-8.0.33-1.el7.x86_64.rpm //安装命令
3.5、安装mysql-community-client-8.0.33-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-8.0.33-1.el7.x86_64.rpm
4、验证MySQL的客户端是否安装成功
mysql -hxxx.xxx.xxx.xxx -uroot -p'xxxxx' -P'3306'-h:指的是你要连接哪台主机-u:表示用那个用户进行访问-p:表示用户的密码,带有特殊字符的时候,最好加上'',要不然系统识别不出来-P:表示MySQL对外暴露的端口号