Permalink
Browse files

Replace removed config options from 5.5 and old 5.6 installations

The two options key-buffer and myisam-recover were replaced in 5.5
with key-buffer-size and myisam-recover-options. In 5.7 the unique-prefix
option that allowed these to work in 5.6 was also removed. If the user
has customized the old config file it will not be replaced and the server
will fail to start.
Renaming these two options in /etc/mysql/my.cnf should clear up a common
upgrade error.
If the config file is changed, we create a backup in
/etc/mysql/my.cnf.migrated.bak (LP: #1571865)
  • Loading branch information...
1 parent fce3bfc commit f57b068c956d0792bb35cec72fee8d66b0f513c7 @ltangvald committed Apr 25, 2016
Showing with 18 additions and 0 deletions.
  1. +18 −0 debian/mysql-server-5.7.postinst
@@ -63,6 +63,18 @@ test_mysqld_startup() {
return $result
}
+# Default config in 5.5 and older 5.6 installations contains two deprecated
+# options that were removed in 5.7. They were renamed, so we can fix this
+# automatically. We create a backup of the old file
+fix_old_config_options() {
+ sed -e 's/key_buffer[[:space:]]*=/# Obsolete key_buffer option renamed to key_buffer_size by maintainer script\nkey_buffer_size\t\t=/' \
+ -e 's/myisam-recover[[:space:]]*=/# Obsolete myisam-recover option renamed to myisam_recover_options by maintainer script\nmyisam_recover_options\t=/' /etc/mysql/my.cnf.migrated --in-place=.bak
+ # If nothing was changed, remove the new file
+ if cmp -s /etc/mysql/my.cnf.migrated /etc/mysql/my.cnf.migrated.bak; then
+ mv /etc/mysql/my.cnf.migrated.bak /etc/mysql/my.cnf.migrated
+ fi
+}
+
# Check if there is passwordless root login
test_mysql_access() {
mysql --no-defaults -u root -h localhost </dev/null >/dev/null 2>&1
@@ -155,6 +167,12 @@ case "$1" in
# data directory and then somewhen gets purged by the admin.
db_set mysql-server/postrm_remove_database false || true
+ # Fix old options that were deprecated in 5.5 and removed in 5.7
+ if dpkg --compare-versions "$2" le-nl "5.7.12-1ubuntu1~"; then
+ echo "Renaming removed key_buffer and myisam-recover options (if present)"
+ fix_old_config_options
+ fi
+
# Sanity check to make sure the server can start
test_mysqld_startup

0 comments on commit f57b068

Please sign in to comment.