You need to download MySQL RPM from MySQL Community. For CentOS 6 you need to download something like this (pay attention to Oracle & Red hat Linux 6 )
You need to download these things
- MySQL-devel (optional)
Login to your CentOS box and get these
cd /root/ mkdir mysql cd mysql wget http://cdn.mysql.com/Downloads/MySQL-5.5/MySQL-server-5.5.32-1.el6.x86_64.rpm wget http://cdn.mysql.com/Downloads/MySQL-5.5/MySQL-shared-5.5.32-1.el6.x86_64.rpm wget http://cdn.mysql.com/Downloads/MySQL-5.5/MySQL-client-5.5.32-1.el6.x86_64.rpm wget http://cdn.mysql.com/Downloads/MySQL-5.5/MySQL-devel-5.5.32-1.el6.x86_64.rpm
first thing you need to check is if some other version mysql is already installed on the box or not.
# yum list installed | grep -i mysql #
If You will see some output like following this means MySQL is already installed, and you need to remove that. if you do not see anything, just ignore the following step and go to RPM installation
MySQL-client.x86_64 5.5.32-1.el6 installed MySQL-devel.x86_64 5.5.32-1.el6 installed MySQL-server.x86_64 5.5.32-1.el6 installed MySQL-shared.x86_64 5.5.32-1.el6 installed
to remove existing MySQL you use following.
**PLEASE NOTE: TAKE DATA BACKUP BEFORE REMOVING OLD MYSQL**
yum remove mysql mysql-*
Once removed you need to remove the /var/lib/mysql, and if you do not remove this directory, you are going to face serious issues in mysql privileges as root.
Most common is grant failed by root. when you try to create a new user and grant some priviliges to it you face following issue
# ERROR 1045 (28000): Access denied for user 'root'@'localhost' #
so while updating Mysql from old version to newer version, you uninstalled mysql, you MUST remove /var/lib/mysql
# mv /var/lib/mysql /var/lib/mysql_OLD_MYSQL #
Mysql needs perl to be installed, so check if you have perl installed.
yum list installed | grep -i perl
if you see some perl is installed, update that,
# yum update perl #
if there is no perl installed, install perl
# yum install perl #
finally install MySQL RPMs, batter in this order.
cd /root/mysql/ rpm -ivh MySQL-shared-5.5.32-1.el6.x86_64.rpm rpm -ivh MySQL-server-5.5.32-1.el6.x86_64.rpm rpm -ivh MySQL-client-5.5.32-1.el6.x86_64.rpm rpm -ivh MySQL-devel-5.5.32-1.el6.x86_64.rpm
Most likely you will not face any issue.
now add Mysql to auto start
# chkconfig mysql on #
service mysql start