skip to Main Content

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:

nano /etc/yum.repos.d/remi.repo

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;

mysql

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?

Sponsored Links
This Post Has 23 Comments
  1. Thanks for this. Repos downloaded fine and it says mysql 5.5 is there when i rpm -qa | grep …. (with one added line on the output: qt-mysql-4.6.2-28.el6_5.x86_64 ) but when I try to login to mysql with -u root and -p then it gives:
    ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2)
    Can you help?
    Thanks,
    Jeff

    1. Hey Jeff,
      Did you start the MySQL server? Check if it’s running with, “ps aux | grep sql”.
      If it’s not running, then:
      service mysqld start
      Thanks!

      1. Yep, that was the problem Andy. Thanks. Also, just out of interest – where in the above instructions does it tell yum that it is version 5.5 that it is updating to (rather than 5.6 or mysql 5.7)? I want to upgrade a centos server running centos 6.7 to only mysql 5.5 from 5.1 but I would not want it to install mysql 5.6 or 5.7 which I understand do exist.
        Thanks,
        Jeff

  2. I not able to create full PRIVILEGES user in mysql,after Upgrade MySQL 5.1 to MySQL 5.5 on CentOS 6.7..
    please help in this.
    error coming :– #1045 – Access denied for user ‘root’@’localhost’ (using password: YES)
    CREATE USER ‘tc’@’localhost’ IDENTIFIED BY ‘***’;GRANT ALL PRIVILEGES ON *.* TO ‘tc’@’localhost’ IDENTIFIED BY ‘***’ REQUIRE NONE WITH GRANT OPTION MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0;
    thanks
    rv

    1. Hello,
      The following line tells the story:
      Access denied for user ‘root’@’localhost’ (using password: YES)
      Basically, you’re using the wrong password to authenticate root.

  3. Thank you! Works well.
    But PHP shows MySQL Client API version 5.1.54 now, I need upgrade it too, at least to 5.5.3 or to 5.5.49 as my MySQL server now. Could you please advise suggestions, thank you.

    1. Hi Andrew,
      My personal suggestion would be to drop php-mysql and instead use php-mysqlnd. libmysqlclient is required for php-mysql usage, and vice-versa. Besides which, if you’re using MySQL 5.5, you may be inclined to take advantage of some of the fancyness that php-mysqlnd introduces.
      Let me know if you run into trouble,
      Thanks!

  4. Hi, when I run the “yum -y update mysql*” command, I get “No Packages marked for Update.” It seems to be checking for updates to 5.1, rather than upgrading to 5.5. Is there a way to specify 5.5?

    1. Hey There,
      When you install and activate REMI/EPEL, MySQL 5.5 should automatically become available as an in-place upgrade. It’s possible your repo configuration was not activated or something along those lines. Double-check the entries in /etc/yum.repos.d/ to make sure you’ve enabled REMI AND EPEL. Also, do me a favor and post the output of “rpm -qa | grep sql” and the output of “yum -y update mysql*”

  5. Same here as above, I get the same message, the out put are:
    rpm -qa | grep sql
    postgresql-libs-8.4.20-5.el6_7.x86_64
    mysql-server-5.1.73-5.el6_7.1.x86_64
    php-mysql-5.3.3-46.el6_7.1.x86_64
    mysql-connector-odbc-5.1.5r1144-7.el6.x86_64
    sqlite-3.6.20-1.el6_7.2.x86_64
    postgresql-server-8.4.20-5.el6_7.x86_64
    mysql-5.1.73-5.el6_7.1.x86_64
    sw-libsqlite3-0-3.7.7.1-11083108.x86_64
    mysql-libs-5.1.73-5.el6_7.1.x86_64
    postgresql-8.4.20-5.el6_7.x86_64
    plesk-mysql-server-12.5.30-cos6.build1205150826.19.x86_64
    And:
    Loaded plugins: fastestmirror
    Setting up Update Process
    Loading mirror speeds from cached hostfile
    * epel: mirror.23media.de
    * epel-debuginfo: mirror.23media.de
    * epel-source: mirror.23media.de
    * remi: rpms.remirepo.net
    * remi-php55: rpms.remirepo.net
    * remi-php56: rpms.remirepo.net
    * remi-safe: rpms.remirepo.net
    * remi-test: rpms.remirepo.net
    No Match for argument: mysqldump
    No package mysqldump available.
    No Packages marked for Update

    1. Hi George,
      Can you send me the FULL output of yum? I can’t tell what packages it was looking for with the concatenated output.
      Thanks!

  6. I wanted to upgrade MySQL 5.1.6 to 5.6 is this the better option or going to 5.5 is the one to proceed with. I have a MySQL version with around 10 huge DB and thinking of creating an instance of MySQL version on the same server and try the testing and upgrades on it. If everything goes well, replicating the same on the live MySQL version. Let me know your thoughts on it and just to inform that I have CentOS 6.x version installed and wanted to upgrade on this platform.

    1. Hello!
      My personal recommendation would be to upgrade to MySQL 5.7 or to MariaDB 10.1, as those are the latest stable releases from Oracle and MariaDB Foundation. Unfortunately, I don’t have any guides on how to do this as of yet, but I’ll put it on the list of articles that need to be written up. For now though, upgrading to 5.5 will at least bring you a step closer to an eventual upgrade to 5.7 if you choose to go the Oracle route.

      1. The risk factor is not sure about this being stable release for MySQL 5.7 as there may be security patches being applied so the safer version should be either 5.5 or 5.6. MariaDB is out of the question here as MySQL version is the one that is initially decided and being huge DBs. So let me know if that is the right path.

        1. In that case, I would then go for the 5.1 to 5.5 upgrade to test things out to ensure stability. Then, whenever you’re ready, you can follow the upgrade path to 5.6 and eventually 5.7. Of course, you should definitely have a full backup of your databases, and if at all possible, test this on a dev system beforehand as you mentioned earlier.

          1. Great, thanks so just to be very specific I am thinking of doing an inplace upgrade from 5.1 to 5.5 and a logical upgrade from 5.5 to 5.6 or 5.7 if you think that will be a stable release without any issues.

Don't be shy, leave a reply!