Can't install mysql on CentOS 7

  • Posted July 12, 2014

It just says no package mysql-server available. I’ve tried every tutorial, egel and whatnot installed. It’s not on the list of things that are not supposed to be installed. Is there a way to force install it from somewhere that’s not from the fastest mirrors so I can see if the mirrors just aren’t working?

edit - I can install mysql-devel, just not anything else.


Centos 7 comes with MariaDB instead of MySQL. MariaDb is a open source equivalent to MySQL and can be installed with yum -y install mariadb-server mariadb. If you must have mysql you need to add the mysql-community repo sudo rpm -Uvh and then you can install MySQLl like you normally do.

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Don’t forget to set it up as a service. This is from the tutorial @Omar posted.

sudo yum -y install mariadb-server mariadb
sudo systemctl start mariadb.service
sudo systemctl enable mariadb.service

Once you do that, you should be able to run the mysql command and it will just let you in.

[vagrant@default ~]$ mysql
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 5.5.37-MariaDB MariaDB Server

Copyright (c) 2000, 2014, Oracle, Monty Program Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> 

So… you’ll probably want to secure it:


MariaDB is shipped in the CentOS repo as of CentOS 7 instead of mysql. if you still want to install mysql you need to add mysql rpm dependency into your yum repo.

check this tutorial out of how to install mysql 5.6 in CentOS7 :

How to install latest mysql 5.6 on CentOS7

We use Centos 7 and have found Percona to meet our needs quite well whether we need a single server or a cluster.

Install Percona XtraDB Cluster on Centos 7

Yes the title is wrong. This is for mariadb which is already installed. I tried adding the yum repository as noted by rparker above ( rpm -Uvh … ) but that failed dependency checks without any detail error messages on cause

Can I migrate MySQL database to Maria DB?

Is it transparent?

Right. CentOS 7 (as well as RHEL 7) does not include MySQL. It instead ships MariaDB which a drop in replacement. You can install it with:

sudo yum install mariadb-server mariadb

Yes it has been.

I’m pretty sure that mysql has been replaced by MariaDB.

Not 100%, sure if this is true in your case but there may not be a package yet. CentOS 7 is only been out for a few days and they changed some of the inner workings in this version. If you are hosting everything on one server (web app & database), I would recommend using CentOS 6.5 now and keep an eye on 7 until package managers catch up to the new release and at that time deploy a CentOS 7 server and rsync all your files over. There also is an upgrade tool to upgrade 6.5 to 7 in the works, you also could take that action. (I would not recommend this, as there could be downtime. When the time comes I would build the CentOS 7 server and transfer everything over. This would mean 5 - 10 minutes downtime if done properly.