To install an alternate version of, in this case, MySQL, rather than to accept the version that is available via the base and update yum repositories for CentOS, there are several ways of going about this. You could install via tar.gz or download RPMs and yum install them directly; however, adding the official MySQL repository will work too. It is important to note, that using the official MySQL repository will install the latest version of MySQL for that point.point release. What if you wanted a previous version? Here is how I did it.
Create access to the MySQL repository. There are several to choose from. 5.5, 5.6, or 5.7. This example will use 5.5.
echo '[mysql55] name=MySQL 5.5 baseurl=http://repo.mysql.com/yum/mysql-5.5-community/el/6/x86_64 gpgcheck=0' > /etc/yum.repos.d/MySQL-5.5.repo
The following command can install the latest version of MySQL 5.5.x.
yum install mysql-community-server
It also shows all the dependencies.
mysql-community-server x86_64 5.5.50-2.el6 mysql55 38 M
mysql-community-client x86_64 5.5.50-2.el6 mysql55 14 M
mysql-community-common x86_64 5.5.50-2.el6 mysql55 277 k
mysql-community-libs x86_64 5.5.50-2.el6 mysql55 1.7 M
mysql-community-libs-compat x86_64 5.5.50-2.el6 mysql55 1.6 M
A most effective method to determine the names of the files to install, the repoquery command is used. To get this command, install yum-utils.
yum install yum-utils
Run the repoquery like so.
repoquery --show-duplicates mysql-community-server
The results should look like this.
Let's assume that the desired version is 5.5.49. Based on the dependencies listed above and using repoquery to search for mysql-community*. The following command installed the desired version of MySQL.
yum install mysql-community-common-0:5.5.49-2.el6.x86_64 \ mysql-community-server-0:5.5.49-2.el6.x86_64 \ mysql-community-libs-compat-0:5.5.49-2.el6.x86_64 \ mysql-community-libs-0:5.5.49-2.el6.x86_64 \ mysql-community-client-0:5.5.49-2.el6.x86_64