Today, I came up with a simple solution to update MySQL from version 5.1 to latest version 5.5. If you are importing database MySQL and getting error about # 1273 Unknown Collation or having other issues while moving from one server to another and need to upgrade MySQL than go through solution provided below. Some simple SSH commands will do all for you.
First of all confirm that you are using older version of MySQL by command given below.
# mysqladmin -u root -p version
Enter the password on prompt and you will get current MySQL version.
Remove Old MySQL:
First of all we will remove old mysql installed in order to install new and latest version. There is no option like upgrade database version, you can have to remove old version and then install latest version. Please take backup of all your database with you which could be recovered if anything went wrong.
# yum remove mysql mysql-*
Add Remi Dependency on CentOS 6.x:
Add following dependencies required to installation of MySQL 5.5 . Commands are as below.
# rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
Install MySQL 5.5:
Now its time to install MySQL 5.5. Use the commands provided below.
# yum –enablerepo=remi,remi-test install -y mysql mysql-server
Now MySQL 5.5 is installed on your server. Now start MySQL with command.
# service mysql restart
Upgrade MySQL Database Final Step:
Final step for upgrading database is as below.
# mysql_upgrade -u root -p
Enter password on prompt and you are done with it.
Note: Some of the users face issue with PHP so we recommend installing php-mysql.
# yum -y install php-mysql