Seth Berrier's picture

Note: this was originally a support question but as often happens, I solved my own problem.  I was able to successfully upgrade to MySQL 5.7 and for other's who may be interested, here's what the process was like.

Warning! Do this at your own risk!  Make sure you backup your database first.  These instructions are by no means an endorsement of 5.7 or it's appropriateness for other programs that use MySQL in your appliance.

Before you begin there is an important change that happened to config options.  Previously you could specify options with any unambiguous prefix of that option.  This was removed in 5.7 (see note at bottom of this page:  Unfortunately, there are several options in the TKL /etc/mysql/my.cnf that need to be changed to fix this:

  • find 'myisam-recover = BACKUP' and change to 'myisam-recover-options = BACKUP'
  • find TWO occurrences of 'key_buffer = 16M' and change to 'key_buffer_size = 16M'

You can now restart your mysql server and it should accept those new options just fine (they aren't anything new, they are just now fully specified instead of using a prefix).

Now, follow the guide at this page under Appendix A: ( Be sure to run 'apt-get update' to pull data from this new source.

Next, edit your /etc/apt/preferences file and add the following entry:

Package: mysql*
Pin: origin ""
Pin-Priority: 1001

This will prioritize the packages from that repo higher than the official debian updates.  Without this, it will blithly ignore the new version.  You can confirm this worked by running: apt-cache policy mysql-server.  The output should show 'candidate' as the latest 5.7 version.

Apt will now do the heavy lifting.  Run apt-get dist-upgrade  Pay particular note about what it wants to upgrade.  There may be other packages that get pulled in when you do a 'dist-upgrade' and you want to be careful.

dpkg will prompt you during the upgrade if you want to use the existing my.cnf file.  Say yes as I believe it has some important TKL settings in it (and we went to the trouble of fixing it anyways).  If all goes well, the upgrade will succeed but pay close attention.  If the new version of mysqld fails to start the install will fail (and it will take a VERY LONG time to timeout waiting for mysqld to fail).  If it does fail, read /var/log/mysql/errors.log to get an idea of what's wrong.

If the install succeeded, the last step is to upgrade the actual data in your database schemas.  Just run mysql_upgrade -u root -p and supply the original mysql root user password you setup when you created the appliance.  This will fix all the stored tables to be compatible with 5.7.

Jeremy Davis's picture

No doubt others may find this of interest so thanks for sharing. :)

FWIW Debian Jessie has MariaDB v10.0 which is compatible with MySQL 5.6 (in case you/somone want/need a newer version of MySQL but don't need v5.7.

Also pinning with a value over 1000 is generally not recommended unless you specifically want to support downgrading a package available from that repo. 1000 should be fine for your purposes.

As a final note, if you wanted to lock this down to ensure that you can't accidentally pull non MySQL packages from the repo, add a wildcard entry prior to your current pin.

In other words, make it look like this:

Package: *
Pin: origin ""
Pin-Priority: 10

Package: mysql*
Pin: origin ""
Pin-Priority: 1000

Add new comment