Centos7的yum安装mysql而不是 mariadb
那一天,开发的让运营这边帮忙布个环境,我义不容辞地接了下来。然后,在centos7上一遍yum,把所有的LAMP 搞定了,正当我觉得完事时,可故事从现在才开始。
开发组要的是纯正的mysql,孤陋寡闻的我也知道MariaDB是mysql的一个分支。
当时太兴奋,也没看安装提示直接就填了yes,等安装完傻眼了,Centos7的默认yum源装的竟然是MariaDB。
好比,开发组明明要的是可口可乐,我要是给他们被凉茶,他们肯定一口凉茶把我喷的。
[root@ecloud ~] # yum -y install mysql mysql-server
…… From : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 Running transaction check Running transaction test Transaction test succeeded Running transaction Warning: RPMDB altered outside of yum. Updating : 1:mariadb-libs-5.5.52-1.el7.x86_64 1/3 Installing : 1:mariadb-5.5.52-1.el7.x86_64 2/3 Cleanup : 1:mariadb-libs-5.5.41-2.el7_0.x86_64 3/3 Verifying : 1:mariadb-5.5.52-1.el7.x86_64 1/3 Verifying : 1:mariadb-libs-5.5.52-1.el7.x86_64 2/3 Verifying : 1:mariadb-libs-5.5.41-2.el7_0.x86_64 3/3
Installed: mariadb.x86_64 1:5.5.52-1.el7
Dependency Updated: mariadb-libs.x86_64 1:5.5.52-1.el7
Complete! |
[root@ecloud ~]# yum remove maria
…… [root@ecloud ~]# yum remove maria-libs …… |
A.到MySQL yum库的下载页面https://repo.mysql.com/
B.找一个跟自己平台匹配的发行包,用uname命令看看自己的平台版本
C . 用wget命令把相应的rpm包下下来,这个包很小只有几k
[root@elcloud ~]# wget https://repo.mysql.com/mysql57-community-release-el7-9.noarch.rpm
--2017-08-25 18:05:56-- https://repo.mysql.com/mysql57-community-release-el7-9.ch.rpm Resolving repo.mysql.com (repo.mysql.com)... 23.56.25.233 Connecting to repo.mysql.com (repo.mysql.com)|23.56.25.233|:443... connected. HTTP request sent, awaiting response... 404 Not Found 2017-08-25 18:05:59 ERROR 404: Not Found.
[root@ecloud ~]# wget https://repo.mysql.com/mysql57-community-release-el7-9.noarch.rpm --2017-08-25 18:06:47-- https://repo.mysql.com/mysql57-community-release-el7-9.noarch.rpm Resolving repo.mysql.com (repo.mysql.com)... 23.56.25.233 Connecting to repo.mysql.com (repo.mysql.com)|23.56.25.233|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 9224 (9.0K) [application/x-redhat-package-manager] Saving to: ‘mysql57-community-release-el7-9.noarch.rpm’
100%[======================>] 9,224 --.-K/s in 0s
2017-08-25 18:06:48 (324 MB/s) - ‘mysql57-community-release-el7-9.noarch.rpm’ saved [9224/9224]
|
[root@ecloud ~]# rpm -Uvh mysql57-community-release-el7-9.noarch.rpm
warning: mysql57-community-release-el7-9.noarch.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY Preparing... ################################# [100%] Updating / installing... 1:mysql57-community-release-el7-9 ################################# [100%] |
[root@ecloud ~]# cat /etc/yum.repos.d/mysql-community.repo
[mysql-connectors-community] name=MySQL Connectors Community baseurl=http://repo.mysql.com/yum/mysql-connectors-community/el/7/$basearch/ enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
[mysql-tools-community] name=MySQL Tools Community baseurl=http://repo.mysql.com/yum/mysql-tools-community/el/7/$basearch/ enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
Enable to use MySQL 5.5[mysql55-community] name=MySQL 5.5 Community Server |
事不宜迟,马上安装(安装前记得要清掉缓存,而且mariadb 一定要删干净)
[root@ecloud ~]# yum install mysql-community-server
Loaded plugins: fastestmirror, langpacks mysql-connectors-community | 2.5 kB 00:00 mysql-tools-community | 2.5 kB 00:00 mysql57-community | 2.5 kB 00:00 (1/3): mysql-tools-community/x86_64/primar | 35 kB 00:00 (2/3): mysql-connectors-community/x86_64/p | 16 kB 00:01 (3/3): mysql57-community/x86_64/primary_db | 116 kB 00:02 Loading mirror speeds from cached hostfile
Resolving Dependencies --> Running transaction check ---> Package mysql-community-server.x86_64 0:5.7.19-1.el7 will be installed --> Processing Dependency: mysql-community-common(x86-64) = 5.7.19-1.el7 for package: mysql-community-server-5.7.19-1.el7.x86_64 --> Processing Dependency: mysql-community-client(x86-64) >= 5.7.9 for package: mysql-community-server-5.7.19-1.el7.x86_64 --> Running transaction check ---> Package mysql-community-client.x86_64 0:5.7.19-1.el7 will be installed --> Processing Dependency: mysql-community-libs(x86-64) >= 5.7.9 for package: mysql-community-client-5.7.19-1.el7.x86_64 ---> Package mysql-community-common.x86_64 0:5.7.19-1.el7 will be installed --> Running transaction check ---> Package mysql-community-libs.x86_64 0:5.7.19-1.el7 will be installed --> Finished Dependency Resolution
Dependencies Resolved
================================================================ Package Arch Version Repository Size ================================================================ Installing: mysql-community-server x86_64 5.7.19-1.el7 mysql57-community 164 M Installing for dependencies: mysql-community-client x86_64 5.7.19-1.el7 mysql57-community 24 M mysql-community-common x86_64 5.7.19-1.el7 mysql57-community 272 k mysql-community-libs x86_64 5.7.19-1.el7 mysql57-community 2.1 M
Transaction Summary ================================================================ Install 1 Package (+3 Dependent packages)
Total download size: 190 M Installed size: 856 M Is this ok [y/d/N]: y Downloading packages: warning: /var/cache/yum/x86_64/7/mysql57-community/packages/mysql-community-common-5.7.19-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY Public key for mysql-community-common-5.7.19-1.el7.x86_64.rpm is not installed (1/4): mysql-community-common-5.7.19-1.el7 | 272 kB 00:01 (2/4): mysql-community-libs-5.7.19-1.el7.x | 2.1 MB 00:01 (3/4): mysql-community-client-5.7.19-1.el7 | 24 MB 00:09 (4/4): mysql-community-server-5.7.19-1.el7 | 164 MB 02:10 Total 1.4 MB/s | 190 MB 02:14 Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql Importing GPG key 0x5072E1F5: Userid : "MySQL Release Engineering <mysql-build@oss.oracle.com>" Fingerprint: a4a9 4068 76fc bd3c 4567 70c8 8c71 8d3b 5072 e1f5 Package : mysql57-community-release-el7-9.noarch (installed) From : /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql Is this ok [y/N]: y Running transaction check Running transaction test Transaction test succeeded Running transaction Warning: RPMDB altered outside of yum. Installing : mysql-community-common-5.7.19-1.el7.x86_64 1/4 Installing : mysql-community-libs-5.7.19-1.el7.x86_64 2/4 Installing : mysql-community-client-5.7.19-1.el7.x86_64 3/4 Installing : mysql-community-server-5.7.19-1.el7.x86_64 4/4 Verifying : mysql-community-libs-5.7.19-1.el7.x86_64 1/4 Verifying : mysql-community-common-5.7.19-1.el7.x86_64 2/4 Verifying : mysql-community-client-5.7.19-1.el7.x86_64 3/4 Verifying : mysql-community-server-5.7.19-1.el7.x86_64 4/4
Installed: mysql-community-server.x86_64 0:5.7.19-1.el7
Dependency Installed: mysql-community-client.x86_64 0:5.7.19-1.el7 mysql-community-common.x86_64 0:5.7.19-1.el7 mysql-community-libs.x86_64 0:5.7.19-1.el7
Complete! |
[root@ecloud ~]# mysql -V
mysql Ver 14.14 Distrib 5.7.19, for Linux (x86_64) using EditLine wrapper |