下载安装包:
https://dev.mysql.com/downloads/mysql/5.7.html#downloads
[root@jenkins-master ~]# cd /usr/local/src/
[root@jenkins-master src]# wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.26-1.el7.x86_64.rpm-bundle.tar
查看旧版本mysql
[root@jenkins-master src]# rpm -ivh *.rpm
error: Failed dependencies: mariadb-libs is obsoleted by mysql-community-libs-5.7.26-1.el7.x86_64 mariadb-libs is obsoleted by mysql-community-libs-compat-5.7.26-1.el7.x86_64 perl(JSON) is needed by mysql-community-test-5.7.26-1.el7.x86_64
[root@localhost src]# yum list mariadb-lib*
[root@localhost src]# yum remove mariadb-lib*
[root@localhost src]# yum -y install net-tools libaio
数据库的初始化
[root@localhost src]# yum -y install perl-Module-Install
必须安装的包:common,server,libs,client
[root@jenkins-master src]# tar -xvf mysql-5.7.26-1.el7.x86_64.rpm-bundle.tar
[root@localhost src]# ll
根据提示安装
[root@localhost src]# rpm -ivh mysql-community-client-5.7.26-1.el7.x86_64.rpm warning: mysql-community-client-5.7.26-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY error: Failed dependencies: mysql-community-libs(x86-64) >= 5.7.9 is needed by mysql-community-client-5.7.26-1.el7.x86_64 [root@localhost src]# rpm -ivh mysql-community-libs-5.7.26-1.el7.x86_64.rpm warning: mysql-community-libs-5.7.26-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY error: Failed dependencies: mysql-community-common(x86-64) >= 5.7.9 is needed by mysql-community-libs-5.7.26-1.el7.x86_64 [root@localhost src]# rpm -ivh mysql-community-common-5.7.26-1.el7.x86_64.rpm warning: mysql-community-common-5.7.26-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY Preparing... ################################# [100%] Updating / installing... 1:mysql-community-common-5.7.26-1.e################################# [100%] [root@localhost src]# rpm -ivh mysql-community-client-5.7.26-1.el7.x86_64.rpm warning: mysql-community-client-5.7.26-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY error: Failed dependencies: mysql-community-libs(x86-64) >= 5.7.9 is needed by mysql-community-client-5.7.26-1.el7.x86_64 [root@localhost src]# rpm -ivh mysql-community-libs-5.7.26-1.el7.x86_64.rpm warning: mysql-community-libs-5.7.26-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY Preparing... ################################# [100%] Updating / installing... 1:mysql-community-libs-5.7.26-1.el7################################# [100%] [root@localhost src]# rpm -ivh mysql-community-client-5.7.26-1.el7.x86_64.rpm warning: mysql-community-client-5.7.26-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY Preparing... ################################# [100%] Updating / installing... 1:mysql-community-client-5.7.26-1.e################################# [100%] [root@localhost src]# mysql --version mysql Ver 14.14 Distrib 5.7.26, for Linux (x86_64) using EditLine wrapper #版本是5.7.26
安装其他两个包,按顺序装,否则可能报错,如果有报错,按照提示
[root@localhost src]# rpm -ivh mysql-community-server-5.7.26-1.el7.x86_64.rpm
[root@localhost src]# rpm -ivh mysql-community-devel-5.7.26-1.el7.x86_64.rpm
安装完成
默认的数据目录在/var/lib/mysql
[root@localhost src]# ll -d /var/lib/mysql
drwxr-x--x. 2 mysql mysql 6 Apr 13 10:40 /var/lib/mysq