upgrade mysql 5.5 to 5.6 ubuntu 14.04

January 1, 2015 112.5k views


I wont to upgrade my mysql server on Ubuntu 14.04 from version 5.5 to 5.6 how can i do that?

7 Answers

While MySql 5.5 is the default for Ubuntu 14.04, MySql 5.6 is available in the default repositories. It can be installed simply using:

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install mysql-server-5.6

If you have existing data in a MySql 5.5 database, it should be migrated automatically. Though it is always a good idea to make a backup before doing a major upgrade.

First make a backup of the data in your existing database:

mysqldump --lock-all-tables -u root -p --all-databases > dump.sql

Then after installing the newer version, you can restore if needed by running:

mysql -u root -p < dump.sql

For more info on migrating MySql databases, check out:

by Mitchell Anicas
How to migrate your existing MySQL database off of your application server to scale your environment. Because every application has its own configuration quirks, with regards to database connections and interactions, we will demonstrate the migration process with WordPress but you can adapt this guide to any other application that uses MySQL as its database.
  • I have try to update but i end up whit a problem the version of the mysqli file for the PHP extension when i upgrade. How can i update that one to support 5.6?

  • Could you provide some more information about the PHP problem? In general though, I suggest staying with the default version unless there is a specific feature you need in the newer release.

  • I end up whit something like this:

    Your PHP MySQL library version 5.5 differs from your MySQL server version 5.6

    That is the error.

  • described above gives :
    Some packages could not be installed. This may mean that you have
    requested an impossible situation or if you are using the unstable
    distribution that some required packages have not yet been created
    or been moved out of Incoming.
    The following information may help to resolve the situation:

    The following packages have unmet dependencies:
    mysql-server-5.6 : Depends: mysql-client-5.6 (>= 5.6.27-0ubuntu0.14.04.1) but it is not going to be installed
    E: Unable to correct problems, you have held broken packages.

    To install you have to do the following:
    sudo apt-get purge mysql-server-5.5 mysql-client-5.5
    sudo apt-get autoremove
    sudo apt-get install mysql-server-5.6 mysql-client-5.6

  • I am getting the following error on installing version 5.6:

    start: Job failed to start
    invoke-rc.d: initscript mysql, action "start" failed.
    dpkg: error processing package mysql-server-5.6 (--configure):
    subprocess installed post-installation script returned error exit status 1
    Processing triggers for ureadahead (0.100.0-16) ...
    E: Sub-process /usr/bin/dpkg returned an error code (1)

    Do i need to increase the memory of my droplet to install MySQL5.6 ???

step 1 : take a backup

mysqldump --lock-all-tables -u root -p --all-databases > dump.sql

step 2 : remove old mysql

sudo apt-get remove mysql-server
sudo apt-get autoremove

step 3 : install new version of mysql

sudo apt-get install mysql-client-5.6 mysql-client-core-5.6

sudo apt-get install mysql-server-5.6

step 4 : restore your data

mysql -u root -p < dump.sql

This one worked for me:

sudo apt-get purge mysql-server*

and after that, I did this:

sudo apt-get install mysql-server-5.6

I am using Ubuntu 14.04 with ServerPilot manager. Serverpilot installs MySQL 5.5 but I need 5.6 to run Magento 2. I tryed to upgrade but did not work and worse, I think I broke ServerPilot integration. Does anyone could run MySQL 5.6 with ServerPilot?

    • I tried that, but my serverpilot panel lost integration with the server at digitalocean, then I needed to rebuild the server and reconnect serverpilot again.
      I do not recommend this upgrade.

      • Could you please tell me how did you reconnected serverpilot again? I used that guide and I think also lost connection with serverpilot none of my database working.

    • Hello, you save my life... I been looking for this for a few days now... although I wonder what all the command that is listed on serverpilot is all about.

      Nevertheless its got the jobs done for me...

      Thank You bro, thats why never never ever miss the comments sections :)))))

Please note!! If you just grabbed the DigitalOcean LAMP pre-built image and you are attempting to upgrade to MySQL 5.6 and getting this error at the end:

E: Sub-process /usr/bin/dpkg returned an error code (1)

It may simply be that you don't have enough RAM. I was getting this error consistently on the low-end droplet with 512MB RAM and nothing worked except... with 1GB of RAM it finally worked. Here's the simple sequence:

sudo apt-get update
sudo apt-get upgrade
sudo apt-get remove mysql-server
sudo apt-get autoremove
sudo apt-get install mysql-server-5.6

Try 1GB RAM!

Over and out.

Hi everyone,

In fact I do not have the same version of MySQL on my old VPS ( wheezy - MySql Server 5.6) and my new one (Jessie 8.5 - MySql 5.5) so my imports cause an errors .

I tried to make a " apt-get install mysql -server- 5.6" but it does not work :
"Is only available from Reviews another source - HOWEVER The Following packages replace it: MariaDB -server- 10.0 "

But once downloaded MariaDB , it will behave like an updated or empty new configuration ?

Thank you

Have another answer? Share your knowledge.