MySQL and Debian 9 “Stretch”
Debian 9 (“Stretch”) was released on June 17, and we congratulate the Debian community on another iteration of a central Linux distro.
Now, the Debian release team some time ago decided not to ship MySQL as part of the distro, instead replacing it with one of the downstream forks. The MySQL team is absolutely committed to making sure that the vast MySQL user base can continue to use Debian as a platform, and we are directing a lot of attention to making sure that MySQL works well on Debian and that our Debian packages and online repos provide everything a Debian user expects. In short: MySQL as a product is advancing rapidly, and so will the experience of using MySQL on Debian.
A somewhat unexpected, late change in Debian 9 may cause those MySQL users who upgrade directly from Debian 8 to 9 to have their MySQL installation yanked out and replaced with something else. So beware: if you want to stay on MySQL and not run the risk of things changing under your feet, you may need to take a few extra steps before you upgrade.
Below, we’ll give advice on the most common scenario, where you have MySQL installed on Debian 8 and you want to go to Debian 9 and continue to run MySQL.
Upgrading to Debian 9 and keeping MySQL
First and foremost: if you installed MySQL from the official MySQL repos at
repo.mysql.com you are fine. No need to worry, since your MySQL installation will be untouched by the Debian upgrade.
On the other hand, if you installed MySQL from Debian’s own package repos and then go ahead and upgrade to Debian 9, Debian will simply yank out MySQL and forcibly replace it with a different database system, with no advance warning. To stay with MySQL, you should switch from the Debian 8 native MySQL (5.5) packages to packages from the official MySQL repos (5.6 or newer). In general, this is advisable for several reasons, among them the fact that all GA and pre-release versions of MySQL, together with a wide range of MySQL clients, tooling and utilities, are all readily available and completely up-to-date in the official repos.
Now, proceed as follows:
- Enable the official MySQL package repos as described at https://dev.mysql.com/downloads/repo/apt/. We recommend choosing the upgrade to MySQL 5.7, which is at the time of writing the latest GA of MySQL and which contains a huge range of new features and optimizations compared with the Debian native 5.5; with 5.6 also being a good but somewhat less recent alternative.
- Switch to the official MySQL packages by running
- Go on to upgrade to Debian 9 by replacing all “jessie” entries with “stretch” in
The end result should be a Debian 9 system which will have your MySQL installation intact.
As we mentioned above, if you have MySQL (from the native Debian 8 repos) on your Debian 8 system and just upgrade directly to Debian 9, you get forcibly migrated off MySQL. Even though the replacement claims full compatibility with MySQL, there are no guarantees. This in turn means that if you want to move back to MySQL afterwards, there are also no guarantees, the reason being that MariaDB may have introduced settings or structures that are incompatible with MySQL. So while a move back to MySQL will in most cases work, be aware that there are risks involved.
Another type of scenario would be that you:
- do not have MySQL installed on Debian 8 and want to upgrade to Debian 9 and run MySQL, or…
- you want a clean install of Debian 9 and then want to run MySQL on it
In both those cases, you should first install or upgrade to Debian 9, then carry out step 1 above (enable the official MySQL repos), then do
apt-get update, and finally
apt-get install mysql-server.
As you can see from this posting, Debian made some late and surprising changes in the Stretch end game. Of course, Debian’s decisions are theirs to make, we just hope that the advice we’ve given here will save users from getting seriously confused and possibly get caught out by having their MySQL install yanked out from under their feet. Many of the gotchas here are unfortunately beyond our control, but do let us know in the comments section below if there appears to be stuff we could do to further reduce risks for MySQL users going to Debian 9.