centos7下使用yum源安裝mysql5.7

摘要:這裏因爲要在雲服務器上佈置mysql 5.7所以記錄過程,希望能有所幫助。

1.查看有哪些版本的mysql,過程如下

yum repolist all | grep mysql

1
2
[root@iZ4qq76j5p04zsZ ~]# yum repolist all | grep mysql
[root@iZ4qq76j5p04zsZ ~]#

輸入命令後我們發現沒有動靜啊,這是因爲現在centos上默認是沒有yum源的,yum安裝的是 MariaDB。所以我們需要自己先配置yum源。

2.下載yum源,過程如下

wget ‘https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
[root@iZ4qq76j5p04zsZ ~]# wget 'https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm'
--2019-10-23 15:29:41--  https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
Resolving dev.mysql.com (dev.mysql.com)... 137.254.60.11
Connecting to dev.mysql.com (dev.mysql.com)|137.254.60.11|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://repo.mysql.com//mysql57-community-release-el7-11.noarch.rpm [following]
--2019-10-23 15:29:43--  https://repo.mysql.com//mysql57-community-release-el7-11.noarch.rpm
Resolving repo.mysql.com (repo.mysql.com)... 23.1.245.43
Connecting to repo.mysql.com (repo.mysql.com)|23.1.245.43|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 25680 (25K) [application/x-redhat-package-manager]
Saving to: ‘mysql57-community-release-el7-11.noarch.rpm’

100%[=====================================================================================================>] 25,680      --.-K/s   in 0.1s    

2019-10-23 15:29:44 (203 KB/s) - ‘mysql57-community-release-el7-11.noarch.rpm’ saved [25680/25680]

[root@iZ4qq76j5p04zsZ ~]#

3安裝yum源,過程如下

rpm -Uvh mysql57-community-release-el7-11.noarch.rpm

1
2
3
4
5
6
[root@iZ4qq76j5p04zsZ ~]# rpm -Uvh mysql57-community-release-el7-11.noarch.rpm
warning: mysql57-community-release-el7-11.noarch.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:mysql57-community-release-el7-11 ################################# [100%]
[root@iZ4qq76j5p04zsZ ~]#

4.再來查看現在有哪些版本的mysql,過程如下

yum repolist all | grep mysql

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
[root@iZ4qq76j5p04zsZ ~]# yum repolist all | grep mysql
mysql-cluster-7.5-community/x86_64 MySQL Cluster 7.5 Community   disabled
mysql-cluster-7.5-community-source MySQL Cluster 7.5 Community - disabled
mysql-cluster-7.6-community/x86_64 MySQL Cluster 7.6 Community   disabled
mysql-cluster-7.6-community-source MySQL Cluster 7.6 Community - disabled
mysql-connectors-community/x86_64  MySQL Connectors Community    enabled:    128
mysql-connectors-community-source  MySQL Connectors Community -  disabled
mysql-tools-community/x86_64       MySQL Tools Community         enabled:    100
mysql-tools-community-source       MySQL Tools Community - Sourc disabled
mysql-tools-preview/x86_64         MySQL Tools Preview           disabled
mysql-tools-preview-source         MySQL Tools Preview - Source  disabled
mysql55-community/x86_64           MySQL 5.5 Community Server    disabled
mysql55-community-source           MySQL 5.5 Community Server -  disabled
mysql56-community/x86_64           MySQL 5.6 Community Server    disabled
mysql56-community-source           MySQL 5.6 Community Server -  disabled
mysql57-community/x86_64           MySQL 5.7 Community Server    enabled:    384
mysql57-community-source           MySQL 5.7 Community Server -  disabled
mysql80-community/x86_64           MySQL 8.0 Community Server    disabled
mysql80-community-source           MySQL 8.0 Community Server -  disabled

5.安裝mysql 5.7,這裏你會發現步驟4中的128,100,384分別對應的幾行對應的是【enabled】,就是現在要安裝的版本信息。這裏如果帶寬小的話,會很慢。

yum install -y mysql-community-server

1
2
3
4
5
6
7
8
9
10
11
12
[root@iZ4qq76j5p04zsZ ~]# yum install -y mysql-community-server
==========================中間省略=====================================
Installed:
  mysql-community-libs.x86_64 0:5.7.28-1.el7  mysql-community-libs-compat.x86_64 0:5.7.28-1.el7  mysql-community-server.x86_64 0:5.7.28-1.el7 

Dependency Installed:
  libaio.x86_64 0:0.3.109-13.el7        mysql-community-client.x86_64 0:5.7.28-1.el7        mysql-community-common.x86_64 0:5.7.28-1.el7       

Replaced:
  mariadb-libs.x86_64 1:5.5.60-1.el7_5                                                                                                         

Complete!

當你看到【Complete】你就已將安裝完成了,到這裏已經安裝是完成了。但是我們不能到此爲止啊,因爲mysql還沒啓動呢!所以我決定繼續

 如果您還需要配置數據庫,登錄,修改數據庫密碼,配置遠程等請參考詳盡版:centos7下使用yum源安裝mysql5.7(詳盡版)

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章