Today you’re going to learn how to upgrade MySQL 5.1 to MySQL 5.5 on CentOS 6.7. This article assumes that you are running the CentOS BASE version of MySQL 5.1. We are ALSO assuming that you are not running this on a live, production environment.
If you do plan on running this on a live server, please make sure to backup your databases beforehand. You will also need to run the mysql_upgrade command after the upgrade from 5.1 to 5.5, to make sure all databases and tables are compatible.
1. Confirm your version of MySQL is CentOS 6.7 default
Type in the following to confirm that you have CentOS 6.7 default of MySQL 5.1 installed:
rpm -qa | grep mysql
Output should look similar to the following:
mysql-server-5.1.73-5.el6_6.x86_64 mysql-libs-5.1.73-5.el6_6.x86_64 mysql-5.1.73-5.el6_6.x86_64
Everything looks good, moving on!
2. Install and activate the REMI and EPEL RPM Repositories
If you have not done so already, install and activate the REMI and EPEL repositories;
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
Now to enable the REMI repository globally:
Under the section that looks like [remi] make the following changes:
[remi] name=Remi's RPM repository for Enterprise Linux 6 - $basearch #baseurl=http://rpms.remirepo.net/enterprise/6/remi/$basearch/ mirrorlist=http://rpms.remirepo.net/enterprise/6/remi/mirror enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi
Type CTRL-O to save, and CTRL-X to exit
3. Update MySQL from 5.1 to 5.5
Simply type in the following:
yum -y update mysql*
Once that’s done, we can verify:
rpm -qa | grep mysql
And we should see something similar to the below:
mysql-5.5.45-1.el6.remi.x86_64 compat-mysql51-5.1.54-1.el6.remi.x86_64 mysql-libs-5.5.45-1.el6.remi.x86_64 mysql-server-5.5.45-1.el6.remi.x86_64
Now we need to make sure MySQL is working correctly.
If you’ve set a root password already, type the following;
mysql -u root -p
If you have not yet set a root password, you can simply type;
You should see something similar to the following
Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 Server version: 5.5.45 MySQL Community Server (GPL) by Remi
There you go! That was easy right?