‹ Articles

How to Upgrade MySQL 5.5 to 5.6 on Ubuntu 14.04

Don't upgrade unless you need to!

Database upgrades are risky. If something goes wrong during the update, all of your data may be lost.
ServerPilot cannot provide support for database upgrades.
For Ubuntu 16.04+, the default MySQL version is 5.7. Updating your existing server to Ubuntu 16.04+ or creating a new server running a recent Ubuntu version is a much safer solution than updating to the unmaintained MySQL 5.6 packages that are available for Ubuntu 14.04.

Check Your Operating System Version

Only servers running Ubuntu 14.04 can upgrade from MySQL 5.5 to MySQL 5.6.

If your server is using Ubuntu 12.04, do not attempt this upgrade.

You can check your server's Ubuntu version with the command:

lsb_release -r

Performing the Upgrade

Important: Take a server snapshot at your provider before upgrading.
All of the databases on your server will be down during the upgrade.

First, log in to your server as the root user.

Then, run the following command to make a backup of your server's databases:

sudo -i mysqldump --lock-all-tables --all-databases --events --ignore-table=mysql.event > dump.sql

Now, perform the upgrade by running the following commands one-by-one:

sudo ln -s /etc/apparmor.d/usr.sbin.mysqld /etc/apparmor.d/disable

sudo invoke-rc.d apparmor restart

sudo replace log_slow_queries slow_query_log_file -- /etc/mysql/conf.d/mysqld_slow_log.cnf

sudo bash -c 'echo "slow_query_log = 1" >> /etc/mysql/conf.d/mysqld_slow_log.cnf'

sudo apt-get purge --assume-yes mysql-server mysql-server-5.5 mysql-server-core-5.5 mysql-client mysql-client-5.5 mysql-client-core-5.5

sudo apt-get update

export DEBIAN_FRONTEND=noninteractive

sudo -E apt-get install --assume-yes mysql-server-5.6 mysql-client-5.6

If all of the commands completed successfully, the upgrade is complete and MySQL 5.6 is running on your server. If there were any problems, you should restore your server to a working snapshot you made before attempting the upgrade.

Still Have Questions?

Don't hesitate to contact us if you can't find the answers to your questions.