Install MySQL 5.6 on CentOS6 [How to specify the version]

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

Add Yum repository

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/. centos6 mysql 1 (2).png

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

MySQL installation

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!

Editing my.cnf

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

Start MySQL

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

Install MySQL 5.6 on CentOS6 [How to specify the version]
How to install MariaDB 10.4 on CentOS 8
Steps to install MySQL 8 on CentOS 8
How to install beta php8.0 on CentOS8
How to install the legacy version [Java]
How to install MySQL
How to install the root certificate of Centos7 (Cybertrust)
How to deploy Laravel on CentOS 7
How to install ImageMagick on Windows 10
Upgrade from MYSQL5.7 to 8.0 on CentOS 6.7
How to install WildFly on Ubuntu 18.04
Steps to install devtoolset-6 on CentOS 7
How to install JDK 8 on Windows without using the installer
How to install GNOME as a desktop environment on CentOS 7
How to install Eclipse (Photon) on Mac
How to install production Metabase on Ubuntu
Install the webmail client Rainloop on CentOS 8
[Rails / Heroku / MySQL] How to reset the DB of Rails application on Heroku
How to install and configure the monitoring tool "Graphite" on Ubuntu
How to change the timezone on Ubuntu
How to install kafkacat on Amazon Linux2
Command to install nginx / PHP7 / php-fpm on CentOS7
How to install network drivers on standalone Ubuntu
Note how to rollback Mysql deployed on Heroku
How to install multiple JDKs on Ubuntu 18.04 LTS
[Rails MySQL] How to reset DB on heroku
Install the latest version of Jenkins on Ubuntu 16
[Ruby on Rails] How to install Bootstrap in Rails
[Java] Memo on how to write the source
How to run NullpoMino 7.5.0 on Ubuntu 20.04.1 64bit version
Install Golang on CentOS 8
Install Neo4j 4.1.3 on centOS
Install Vertica 10.0 on CentOS 6.10
Install PostgreSQL 12 on Centos8
How to install Docker
Install nginx on centOS7
Install Python 3 on CentOS 7
How to install docker-machine
Install kuromoji on CentOS7
Install Mattermost on CentOS 7
Install PostGIS 2.5.5 on CentOS7
Install jpndistrict on CentOS 7
Install Redmine 4.1.1 on CentOS 7
Smokeping Install on CentOS7
Install PostgreSQL 13 on CentOS 7.5
How to install ngrok
How to share on the host side (windows) and guest side (CentOS 7) with VirtualBox
How to install Ruby on an EC2 instance on AWS
[Ruby on Rails] How to change the column name
Install the latest hardware drivers from ELRepo on CentOS
[SwiftUI] How to specify the abbreviated position of Text
How to specify the resource path in HTML import
How to download the old version of Apache Tomcat
Install ag (the silver searcher) [on CentOS / Ubuntu / Mac]
How to install Docker in the local environment of an existing Rails application [Rails 6 / MySQL 8]
How to lower java version
[Rails] How to install devise
How to deploy on heroku
Install OpenFOAM v2006 on CentOS
Install Jenkins on Docker's CentOS
Install Apache on CentOS on VirtualBox