Redhat Enterprise Linux (RHEL) 6.x and CentOS 6.x have been providing MySQL 5.1 in its distribution since that was the active stable branch when RHEL 6.0 was released. Since then, Sun/Oracle have released MySQL 5.5, so the Webtatic Yum repository has added them to its web stack, which now provides updated versions of all the AMP in LAMP.
Update 2014-03-01 - mysql55 packages have been renamed to mysql55w packages (as well as mysql51 to mysql51w). This is to ensure it doesn’t clash with SCL packages.
Update 2013-05-11 - Updated guide to include Webtatic EL6 mysql55w installation and simplfied package upgrade
First, to set up the yum repository, install the webtatic-release RPM based on your CentOS/RHEL release:
Webtatic EL6 for CentOS/RHEL 6.x:
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm
If you already have MySql client or server installed (rpm -q mysql mysql-server), then you can upgrade using the following method:
yum install mysql.`uname -i` yum-plugin-replace yum replace mysql --replace-with mysql55w
“yum install mysql” is only there to make sure yum-plugin-replace can resolve dependencies correctly if only mysql-server was installed.
Otherwise, to install MySql client and server, then run:
yum install mysql55w mysql55w-server
You should upgrade existing tables before setting the server to become a production machine, which can be done by starting the server and running the mysql_upgrade script (this may take time depending on the size of the database).
service mysqld start # This will issue a password prompt for the user. If you don't have a root user password, remove the "-p" mysql_upgrade -u root -p