MySQL 8 Cookbook
上QQ阅读APP看书,第一时间看更新

Using YUM repositories

  1. Find the Red Hat or CentOS version:
shell> cat /etc/redhat-release
CentOS Linux release 7.3.1611 (Core)
  1. Add the MySQL Yum repository to your system's repository list. This is a one-time operation that can be performed by installing an RPM provided by MySQL.
    You can download the MySQL YUM Repository from http://dev.mysql.com/downloads/repo/yum/ and choose the file depending on your OS.
    Install the downloaded release package with the following command, replacing the name with the platform- and version-specific package name of the downloaded RPM package:
shell> sudo yum localinstall -y mysql57-community-release-el7-11.noarch.rpm
Loaded plugins: fastestmirror
Examining mysql57-community-release-el7-11.noarch.rpm: mysql57-community-release-el7-11.noarch
Marking mysql57-community-release-el7-11.noarch.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package mysql57-community-release.noarch 0:el7-11 will be installed
--> Finished Dependency Resolution
~
Verifying : mysql57-community-release-el7-11.noarch 1/1

Installed:
mysql57-community-release.noarch 0:el7-11
Complete!
  1. Or you can copy the link location and install directly using RPM (you can skip the next step after installing):
shell> sudo rpm -Uvh "https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm"
Retrieving https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
Preparing... ################################# [100%]
Updating / installing...
1:mysql57-community-release-el7-11 ################################# [100%]
  1. Verify the installation:
shell> yum repolist enabled | grep 'mysql.*-community.*'
mysql-connectors-community/x86_64 MySQL Connectors Community 42
mysql-tools-community/x86_64 MySQL Tools Community 53
mysql57-community/x86_64 MySQL 5.7 Community Server 227
  1. Set the release series. At the time of writing this book, MySQL 8 is not a general availability (GA) release. So MySQL 5.7 will be selected as the default release series. To install MySQL 8, you have to set the release series to 8:
shell> sudo 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: 42
mysql-connectors-community-source MySQL Connectors Community disabled
mysql-tools-community/x86_64 MySQL Tools Community enabled: 53
mysql-tools-community-source MySQL Tools Community - Sou disabled
mysql-tools-preview/x86_64 MySQL Tools Preview disabled
mysql-tools-preview-source MySQL Tools Preview - Sourc 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: 227
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
  1. Disable mysql57-community and enable mysql80-community:
shell> sudo yum install yum-utils.noarch -y
shell> sudo yum-config-manager --disable mysql57-community
shell> sudo yum-config-manager --enable mysql80-community
  1. Verify that mysql80-community is enabled:
shell> sudo yum repolist all | grep mysql8
mysql80-community/x86_64 MySQL 8.0 Community Server enabled: 16
mysql80-community-source MySQL 8.0 Community Server disabled
  1. Install MySQL 8:
shell> sudo yum install -y mysql-community-server
Loaded plugins: fastestmirror
mysql-connectors-community | 2.5 kB 00:00:00
mysql-tools-community | 2.5 kB 00:00:00
mysql80-community | 2.5 kB 00:00:00
Loading mirror speeds from cached hostfile
* base: mirror.web-ster.com
* epel: mirrors.cat.pdx.edu
* extras: mirrors.oit.uci.edu
* updates: repos.lax.quadranet.com
Resolving Dependencies
~
Transaction test succeeded
Running transaction
Installing : mysql-community-common-8.0.3-0.1.rc.el7.x86_64 1/4
Installing : mysql-community-libs-8.0.3-0.1.rc.el7.x86_64 2/4
Installing : mysql-community-client-8.0.3-0.1.rc.el7.x86_64 3/4
Installing : mysql-community-server-8.0.3-0.1.rc.el7.x86_64 4/4
Verifying : mysql-community-libs-8.0.3-0.1.rc.el7.x86_64 1/4
Verifying : mysql-community-common-8.0.3-0.1.rc.el7.x86_64 2/4
Verifying : mysql-community-client-8.0.3-0.1.rc.el7.x86_64 3/4
Verifying : mysql-community-server-8.0.3-0.1.rc.el7.x86_64 4/4

Installed:
mysql-community-server.x86_64 0:8.0.3-0.1.rc.el7
Dependency Installed:
mysql-community-client.x86_64 0:8.0.3-0.1.rc.el7
mysql-community-common.x86_64 0:8.0.3-0.1.rc.el7
mysql-community-libs.x86_64 0:8.0.3-0.1.rc.el7

Complete!
  1. You can check the installed packages using the following:
shell> rpm -qa | grep -i 'mysql.*8.*'
perl-DBD-MySQL-4.023-5.el7.x86_64
mysql-community-libs-8.0.3-0.1.rc.el7.x86_64
mysql-community-common-8.0.3-0.1.rc.el7.x86_64
mysql-community-client-8.0.3-0.1.rc.el7.x86_64
mysql-community-server-8.0.3-0.1.rc.el7.x86_64