# How to install MySQL 5.6 on CentOS 7

**URL:** <https://forums.thehomestack.io/t/how-to-install-mysql-5-6-on-centos-7/12262>\
**Category:** Linux - General\
**Created:** [May 21, 2016, 2:31pm UTC](https://forums.thehomestack.io/t/how-to-install-mysql-5-6-on-centos-7/12262 "2016-05-21T14:31:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![steve.ling](https://forums.thehomestack.io/letter_avatar_proxy/v4/letter/s/d6d6ee/32.png) [@steve.ling](https://forums.thehomestack.io/u/steve.ling)\
**Post date:** [May 21, 2016, 2:31pm UTC](https://forums.thehomestack.io/t/how-to-install-mysql-5-6-on-centos-7/12262/1 "2016-05-21T14:31:23Z")

</div>

The first step is to setup Oracle’s MySQL repository, for that, we can go to the [mysql.com](http://mysql.com/) website, click on “[Downloads](http://dev.mysql.com/downloads/)“, then “[Yum repository](http://dev.mysql.com/downloads/repo/yum/)” and then “Red Hat Enterprise Linux 7”. At the moment of the writing of these lines, this version of the repository setup package is still in beta, but I had no problems to install it with several combinations of software and hardware. Select “[Download](http://dev.mysql.com/downloads/file.php?id=450705)” and you can choose to login or create an Oracle account. We can also skip that step and just copy the link on “No thanks , just start my download”. This will provide us [the address of the rpm to auto-configure the MySQL Community Server repository](http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm).

If you have mysql installed already you will have to shut it down to upgrade, if it is not installed then you can simply move on.  
Now, if we execute on the terminal:

I you have MySQL installed run this command first:

```auto
systemctl stop mysqld

```

If MySQL is not installed run this command:

```auto
yum -y install http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm

```

Run this command to check if the repository is active:

```auto
yum repolist enabled | grep "mysql.*-community.*"

```

The next step is actually installing the server packages:

```auto
yum -y install mysql-community-server

```

As you can see, the community server package defaults to the latest version of MySQL 5.6. During the installation process, only two interruptions may happen (aside from the sudo password), one for confirmation of changes, and another to import the Oracle release engineers’ key on your system, which should be fine if it matches the fingerprint a4a9 4068 76fc bd3c 4567 70c8 8c71 8d3b 5072 e1f5. Remember that for automatic processes, we can give the -y (assume yes to all) flag to yum, but I wanted to avoid that for explanation and security purposes.

We are done with the installation, now we only have to run it and test it. Remember that Red Hat Enterprise Linux 7 replaces the management of services with systemd, so the “correct” way of starting the mysql service is:

```auto
systemctl start mysqld

```

You can check that it started successfully by running:

```auto
systemctl status mysqld

```

Remember also to activate the mysql auto-start on boot, as you will want in most cases (this has also changed from CentOS 6):

```auto
systemctl enable mysqld.service

```

You can check that it was enabled successfully with the previously shown ‘status’ command; it should be shown now as “enabled”.

As good administrator, the next steps will be to properly configure user accounts and securize the database service, but that is out of the scope of this tutorial.

Since you have installed MySQL via the repository, now your packages can be easily upgraded by using yum.

For a more detailed documentation, you can also review the official docs. The Oracle engineers also have an interesting story about the testing process of these packages.

I hope this tutorial has been helpful.
