CentOS7默认安装MariaDB而不是MySQL,而且yum服务器上也移除了MySQL相关的软件包。因为MariaDB和MySQL可能会冲突,故先卸载MariaDB。
1、安装新版mysql之前,我们需要将系统自带的mariadb-lib卸载
[root@linuxidc home]# rpm -qa | grep -i mariadb mariadb-libs-5.5.52-1.el7.x86_64 [root@linuxidc home]# rpm -e --nodeps mariadb-libs-5.5.52-1.el7.x86_64
2、到mysql的官网下载最新版mysql的rpm集合包:mysql-5.7.18-1.el6.x86_64.rpm-bundle.tar
3、上传mysql-5.7.18-1.el6.x86_64.rpm-bundle.tar到linux服务器,并解压tar包
[root@linuxidc home]# mkdir mysql [root@linuxidc home]# tar -xf mysql-5.7.18-1.el6.x86_64.rpm-bundle.tar -C mysql [root@linuxidc home]# cd mysql [root@linuxidc mysql]# ll total 459492 -rw-r--r-- 1 7155 31415 23618836 Mar 20 17:40 mysql-community-client-5.7.18-1.el6.x86_64.rpm -rw-r--r-- 1 7155 31415 335496 Mar 20 17:40 mysql-community-common-5.7.18-1.el6.x86_64.rpm -rw-r--r-- 1 7155 31415 3747352 Mar 20 17:40 mysql-community-devel-5.7.18-1.el6.x86_64.rpm -rw-r--r-- 1 7155 31415 39086508 Mar 20 17:40 mysql-community-embedded-5.7.18-1.el6.x86_64.rpm -rw-r--r-- 1 7155 31415 135869292 Mar 20 17:40 mysql-community-embedded-devel-5.7.18-1.el6.x86_64.rpm -rw-r--r-- 1 7155 31415 2177064 Mar 20 17:40 mysql-community-libs-5.7.18-1.el6.x86_64.rpm -rw-r--r-- 1 7155 31415 1723180 Mar 20 17:40 mysql-community-libs-compat-5.7.18-1.el6.x86_64.rpm -rw-r--r-- 1 7155 31415 159060212 Mar 20 17:41 mysql-community-server-5.7.18-1.el6.x86_64.rpm -rw-r--r-- 1 7155 31415 104881084 Mar 20 17:41 mysql-community-test-5.7.18-1.el6.x86_64.rpm
4、使用rpm -ivh命令进行安装
[root@linuxidc mysql]# rpm -ivh mysql-community-common-5.7.18-1.el6.x86_64.rpm warning: mysql-community-common-5.7.18-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY Preparing... ################################# [100%] Updating / installing... 1:mysql-community-common-5.7.18-1.e################################# [100%] [root@linuxidc mysql]# rpm -ivh mysql-community-libs-5.7.18-1.el6.x86_64.rpm warning: mysql-community-libs-5.7.18-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY Preparing... ################################# [100%] Updating / installing... 1:mysql-community-libs-5.7.18-1.el6################################# [100%] [root@linuxidc mysql]# rpm -ivh mysql-community-client-5.7.18-1.el6.x86_64.rpm warning: mysql-community-client-5.7.18-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY Preparing... ################################# [100%] Updating / installing... 1:mysql-community-client-5.7.18-1.e################################# [100%] [root@linuxidc mysql]# rpm -ivh mysql-community-server-5.7.18-1.el6.x86_64.rpm warning: mysql-community-server-5.7.18-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY Preparing... ################################# [100%] Updating / installing... 1:mysql-community-server-5.7.18-1.e################################# [100%] [root@linuxidc mysql]#
上面几个包有依赖关系,执行有先后。
使用rpm安装方式安装mysql,安装的路径如下: