← ServerPilot Docs

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.

Careful! We can't provide support for database upgrades or for any errors, downtime, or vulnerabilities you introduce through the upgrade.

Unless you're absolutely sure about what you're doing, you should stop now!

For Ubuntu 16.04 and 18.04, the default MySQL version is 5.7. Updating your existing server to Ubuntu 16.04 or creating a new server running the most recent Ubuntu LTS version is a much safer solution than updating to the unmaintained MySQL 5.6 packages that are available for Ubuntu 14.04. If you decide to create a new server, you can migrate your apps using our free migration service: DataShuttle.

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.

Last updated: May 20, 2020

Launch your first site in 5 minutes