This time, I will explain the procedure when you want to install the latest version of MySQL when building the environment.
The working environment is as follows. Server OS: CentOS6 MySQL:MySQL5.6
Install the one that matches your OS version from the official MySQL Yum repository. URL: https://dev.mysql.com/downloads/repo/yum/
$ sudo yum localinstall http://dev.mysql.com/get/mysql80-community-release-el6-3.noarch.rpm
Here, CentOS6 is selected, but you can install other versions by looking at the red frame part in the image below and changing after http://dev.mysql.com/get/.
Check if it was installed.
$ yum repolist all | grep mysql
mysql-cluster-7.5-community MySQL Cluster 7.5 Community disabled
mysql-cluster-7.5-community-source MySQL Cluster 7.5 Community -So invalid
mysql-cluster-7.6-community MySQL Cluster 7.6 Community disabled
mysql-cluster-7.6-community-source MySQL Cluster 7.6 Community -So invalid
mysql-cluster-8.0-community MySQL Cluster 8.0 Community disabled
mysql-cluster-8.0-community-source MySQL Cluster 8.0 Community -So invalid
mysql-connectors-community MySQL Connectors Community Valid: 145
mysql-connectors-community-source MySQL Connectors Community -Sou disabled
mysql-tools-community MySQL Tools Community enabled: 96
mysql-tools-community-source MySQL Tools Community -Source disabled
mysql-tools-preview MySQL Tools Preview disabled
mysql-tools-preview-source MySQL Tools Preview -Source disabled
mysql55-community MySQL 5.5 Community Server disabled
mysql55-community-source MySQL 5.5 Community Server -Sou disabled
mysql56-community MySQL 5.6 Community Server disabled: 625
mysql56-community-source MySQL 5.6 Community Server -Sou disabled
mysql57-community MySQL 5.7 Community Server disabled
mysql57-community-source MySQL 5.7 Community Server -Sou disabled
mysql80-community MySQL 8.0 Community Server Enabled
mysql80-community-source MySQL 8.0 Community Server -Sou disabled
Looking at the above, you can see that MySQL 8.0 is enabled and 5.6 is disabled. If you install it as it is, 8.0 that is enabled will be installed. So you need to switch to 5.6. To switch, you need the yum-utils package for changing yum settings, so install it.
$ sudo yum -y install yum-utils
$ yum-config-manager --disable mysql80-community <-8.Set 0 to disabled
$ yum-config-manager --enable mysql56-community <-5.6 enabled
Check the settings again and if 5.6 is enabled, it's OK.
$ yum repolist all | grep mysql
mysql-cluster-7.5-community MySQL Cluster 7.5 Community disabled
mysql-cluster-7.5-community-source MySQL Cluster 7.5 Community -So invalid
mysql-cluster-7.6-community MySQL Cluster 7.6 Community disabled
mysql-cluster-7.6-community-source MySQL Cluster 7.6 Community -So invalid
mysql-cluster-8.0-community MySQL Cluster 8.0 Community disabled
mysql-cluster-8.0-community-source MySQL Cluster 8.0 Community -So invalid
mysql-connectors-community MySQL Connectors Community Valid: 145
mysql-connectors-community-source MySQL Connectors Community -Sou disabled
mysql-tools-community MySQL Tools Community enabled: 96
mysql-tools-community-source MySQL Tools Community -Source disabled
mysql-tools-preview MySQL Tools Preview disabled
mysql-tools-preview-source MySQL Tools Preview -Source disabled
mysql55-community MySQL 5.5 Community Server disabled
mysql55-community-source MySQL 5.5 Community Server -Sou disabled
mysql56-community MySQL 5.6 Community Server Enabled: 625
mysql56-community-source MySQL 5.6 Community Server -Sou disabled
mysql57-community MySQL 5.7 Community Server disabled
mysql57-community-source MySQL 5.7 Community Server -Sou disabled
mysql80-community MySQL 8.0 Community Server disabled
mysql80-community-source MySQL 8.0 Community Server -Sou disabled
Now that you have added the official MySQL Yum repository, install it with the yum install command. First, let's check the details of the mysql-community-server package.
$ yum info mysql-community-server
If you can confirm that the version is 5.6, install it.
$ sudo yum install mysql-community-server
Check the version.
$ mysqld --version
mysqld Ver 5.6.50 for Linux on x86_64 (MySQL Community Server (GPL))
You have successfully installed MySQL 5.6!
Make the initial settings easily.
$ sudo cp /etc/my.cnf /etc/my.cnf.org
$ vi /etc/my.cnf
Add the following to specify the default character code.
[mysqld]
character-set-server=utf8 <-- [mysqld]Add to section
Now that you have MySQL installed, let's start it right away.
$ sudo service mysqld start
Make settings to start automatically when the server starts.
$ sudo chkconfig mysqld on <-Set to automatic startup
$ sudo chkconfig mysqld off <-Do not start automatically
Let's check the status of MySQL.
$ service mysqld status
Let's stop MySQL.
$ sudo service mysqld stop
That's all for the settings.
Recommended Posts