After a centos user logs on to the Amazon EC2 server, the sudo user goes to the root user.
Run the yum install mysql-server command in CentOS7 AMI to find that the mysql server cannot be installed.
# Sudo su-
# Yum install mysql-server
Loaded plugins: fastestmirror
Base | 3.6 kB
Epel/x86_64/metalink | 5.5 kB
Epel | 4.4 kB: 00
Extras | 3.4 kB: 00
Rpmforge | 1.9 kB: 00
Updates | 3.4 kB: 00
Epel/x86_64/primary_db | 3.8 MB
(1/2): epel/x86_64/updateinfo | 230 kB
(2/2): epel/x86_64/pkgtags | 1.3 MB: 00
Loading mirror speeds from cached hostfile
* Base: www.ftp.ne.jp
* Epel: s3-mirror-ap-northeast-1.fedoraproject.org
* Extras: www.ftp.ne.jp
* Rpmforge: ftp.riken.jp
* Updates: www.ftp.ne.jp
No package mysql-server available.
Error: Nothing to do
Because the default database for CentOS7 is MariaDB.
1. Configure the Repository of MySQL5.6
Visit http://www.mysql.com/downloads/and click "downloads?&rarr=" yum Repository 」.
Select Red Hat Enterprise Linux 7/Oracle Linux 7 (Architecture Independent) and "Download" for the RPM Package 」
The logon to Oracle page is displayed, but you do not need to log on. Copy the No thanks, just start my download. Link.
The copied link is: http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
Configure the yum source of MySQL5.6.
# Rpm-ivh http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
Retrieving http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
Preparing... ################################### [100%]
Updating/installing...
1: mysql-community-release-el7-5 ################################# [100%]
Check that the MySQL5.6yum source exists.
# Yum repolist
Loaded plugins: fastestmirror
Mysql-connectors-community | 2.5 kB: 00
Mysql-tools-community | 2.5 kB: 00
Mysql56-community | 2.5 kB 00: 00
(1/3): mysql-connectors-community/x86_64/primary_db | 7.0 kB
(2/3): mysql-tools-community/x86_64/primary_db | 11 kB
(3/3): mysql56-community/x86_64/primary_db | 59 kB
Loading mirror speeds from cached hostfile
* Base: www.ftp.ne.jp
* Epel: ftp.jaist.ac.jp
* Extras: www.ftp.ne.jp
* Rpmforge: ftp.riken.jp
* Updates: www.ftp.ne.jp
Repo id repo name status
Base/7/x86_64 CentOS-7-Base 8,465
Epel/x86_64 Extra Packages for Enterprise Linux 7-6,912
Extras/7/x86_64 CentOS-7-Extras 102
Mysql-connectors-community/x86_64 MySQL Connectors Community 12
Mysql-tools-community/x86_64 MySQL Tools Community 12
Mysql56-community/x86_64 MySQL 5.6 Community Server 94
Rpmforge RHEL 7-RPMforge.net-dag 245
Updates/7/x86_64 CentOS-7-Updates 1,497
Repolist: 17,339
2. Install MySQL
# Yum install mysql-server
# Mysql -- version
Mysql Ver 14.14 Distrib 5.6.22, for Linux (x86_64) using EditLine wrapper
MySQL5.6.22 is successfully installed on the Amazon CentOS7 AMI.
Summary
CentOS7 seems to have changed a lot. It seems that the service command has changed to the systemctl command.
# Service mysqld stop
Redirecting to/bin/systemctl stop mysqld. service