Upgrade Ubuntu 14.04.5 LTS to 16.04.3 LTS: mysql

Updating from 14.04.5 LTS to 16.04.3 LTS can be tricky in some details. The most parts will run fine during the update, but for mysql there simply isn’t a migration path from 5.5 to 5.7 directly.

Before anything else, backup your data first!

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

First you’ll have to upgrade vom 5.5 to 5.6, this happens pretty straightforward via the provided packages:

sudo apt update
sudo apt install mysql-server-5.6 mysql-client-5.6 mysql-server-core-5.6 mysql-client-core-5.6

The trouble is, that the packages for 5.7 are not available on Ubuntu 14.04.5 LTS. If you want to transfer the data from a host running 14.04.5 to another host running on 16.04.3, you’ll have to upgrade to 5.7 first. If you want to upgrade the host currently running your mysqld, you can just continue with do-release-upgrade, the upgrade to mysql 5.7 handles the database structure upgrade just fine.

To upgrade to mysql 5.7, you’ll have to leave the supported upgrade path from ubuntu 14.04 and insert your own apt-source from mysql.

Download the latest mysql-apt-config_w.x.y-z_all.deb from https://dev.mysql.com/downloads/repo/apt/, mine was mysql-apt-config_0.8.9-1_all.deb.

sudo gdebi mysql-apt-config_0.8.9-1_all.deb
sudo apt update
sudo apt install mysql-server
mysql_upgrade -u root -p
sudo service mysql restart

If you get errors like „Couldn’t execute ‚SHOW VARIABLES LIKE ‚gtid\_mode“: Native table ‚performance_schema‘.’session_variables‘ has the wrong structure“, you forgot to restart your mysql-server.

This answer from askubuntu.com helped me work out the details.

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.