MySQL upgrade fails on Ubuntu 16.04

I have Ubuntu 16.04 running (clean install - no upgrade). MySQL is running fine - but I get this error when I try to update MySQL:

apt-get install
Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up mysql-server-5.7 (5.7.16-0ubuntu0.16.04.1) ...
Checking if update is needed.
Checking server version.
Running queries to upgrade MySQL server.
Checking system database.
mysql.columns_priv                                 OK
mysql.db                                           OK
mysql.engine_cost                                  OK
mysql.event                                        OK
mysql.func                                         OK
mysql.general_log                                  OK
mysql.gtid_executed                                OK
mysql.help_category                                OK
mysql.help_keyword                                 OK
mysql.help_relation                                OK
mysql.help_topic                                   OK
mysql.innodb_index_stats                           OK
mysql.innodb_table_stats                           OK
mysql.ndb_binlog_index                             OK
mysql.plugin                                       OK
mysql.proc                                         OK
mysql.procs_priv                                   OK
mysql.proxies_priv                                 OK
mysql.server_cost                                  OK
mysql.servers                                      OK
mysql.slave_master_info                            OK
mysql.slave_relay_log_info                         OK
mysql.slave_worker_info                            OK
mysql.slow_log                                     OK
mysql.tables_priv                                  OK
mysql.time_zone                                    OK
mysql.time_zone_leap_second                        OK
mysql.time_zone_name                               OK
mysql.time_zone_transition                         OK
mysql.time_zone_transition_type                    OK
mysql.user                                         OK
The sys schema is already up to date (version 1.5.1).
Checking databases.


Error occurred: Error during call to mysql_check.
mysql_upgrade failed with exit status 4
dpkg: error processing package mysql-server-5.7 (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of mysql-server:
 mysql-server depends on mysql-server-5.7; however:
  Package mysql-server-5.7 is not configured yet.

dpkg: error processing package mysql-server (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
E: Sub-process /usr/bin/dpkg returned an error code (1)

Although it's running, I dont like errors. Do you guys have any idea how to fix this issue?

Running dpkg -l | grep mysql gives:

dpkg -l | grep mysql 
ii  libdbd-mysql-perl                  4.033-1ubuntu0.1                                     amd64        Perl5 database interface to the MySQL database
ii  libmysqlclient20:amd64             5.7.16-0ubuntu0.16.04.1                              amd64        MySQL database client library
ii  mysql-client                       5.7.16-0ubuntu0.16.04.1                              all          MySQL database client (metapackage depending on the latest version)
ii  mysql-client-5.7                   5.7.16-0ubuntu0.16.04.1                              amd64        MySQL database client binaries
ii  mysql-client-core-5.7              5.7.16-0ubuntu0.16.04.1                              amd64        MySQL database core client binaries
ii  mysql-common                       5.7.16-0ubuntu0.16.04.1                              all          MySQL database common files, e.g. /etc/mysql/my.cnf
iU  mysql-server                       5.7.16-0ubuntu0.16.04.1                              all          MySQL database server (metapackage depending on the latest version)
iF  mysql-server-5.7                   5.7.16-0ubuntu0.16.04.1                              amd64        MySQL database server binaries and system database setup
ii  mysql-server-core-5.7              5.7.16-0ubuntu0.16.04.1                              amd64        MySQL database server binaries
ii  php-mysql                                       all          MySQL module for PHP [default]
ii  php5.6-mysql                                    amd64        MySQL module for PHP
ii  php7.0-mysql                                    amd64        MySQL module for PHP


I've run into this myself and I believe it has to do with how the upgrade process stops/starts/restarts MySQL.

Here is my workaround that I do after an attempted upgrade of MySQL fails.

  1. Start MySQL normally, typically "service mysql start" as root.
  2. As root execute "mysql_upgrade --defaults-file=/etc/mysql/debian.cnf". Hopefully it should complete with no errors or indicate that MySQL is already upgraded.
  3. Edit the file "/var/lib/dpkg/info/mysql-server-5.7.postinst" with your favorite editor. Around line 320 (depending on version) find the line "mysql_upgrade --defaults-file=/etc/mysql/debian.cnf || result=$?". Comment that line out (prepend line with '#'), if should look like "#mysql_upgrade --defaults-file=/etc/mysql/debian.cnf || result=$?". Save the file and exit from the editor.
  4. Rerun the upgrade process and it should indicate that MySQL is now upgraded.

At some point I will dig further to see why the "mysql_upgrade ..." invocation fails during the upgrade but not alone from the command line. But I've not gone through a few iterations of upgrades without issue using this method.

Hope this helps.


16.04 upgrade broke mysql-server, We all been there when an update fails but with an LTS server version you would think this would be something the Ubuntu team would fix quickly  I am trying to upgrade existing Ubuntu 14.04 LTS to Ubuntu 16.04 LTS and it seems I am stuck somewhere in the middle. When I turn on my workstation, I get Ubuntu 16.04 LTS welcome & login screen,

NOTE: This is for upgrading MySQL with "mysql_secure_installation" fix.

Had problems with upgrading MySQL Server 5.7 in Ubuntu 16.04 and I finally located my problem. I enabled "mysql_secure_installation" during my first installation that causes the upgrade script to fail due to password creation error (unsatisfied special character requirement on the automatically generated password in the upgrade script).

While running 'sudo apt upgrade' or 'sudo apt install -f', the error can be traced using this command:

tail -f /var/log/mysql/error.log

In my case, the log shows:

[ERROR] 1819 Your password does not satisfy the current policy requirements

To fix this, login to mysql and temporarily disable MySQL's validate password plugin:

mysql -u root -p -h

mysql> uninstall plugin validate_password;

mysql> exit

make sure to stop the previous upgrade/install and rerun the upgrade/install. Once done, login back to mysql and enable MySQL's validate password plugin;

mysql -u root -p -h

mysql> install plugin validate_password SONAME '';

mysql> exit

Ubuntu 16.04 mysql update fails, Have you checked:​1571865 (linked from the XenialXerus release notes at  Here is the issue we had after updating to 8.0.16 on Ubuntu Environment is Ubuntu 16.04 LTS Failed to start MySQL Community Server upgrade fails due to

I've had this issue before, the root cause for this issue was changing the db configuration. I changed lower_case_table_names = 1 and set the value to one, and when I tried to upgrade it failed with the error you shared in your question.

To solve it, I simple set the value back to 0, restarted the db, and the upgrade worked well for me.

First edit the config:

sudo nano /etc/mysql/my.cnf

change this line:

lower_case_table_names = 0

restart the database

sudo /etc/init.d/mysql restart 

Then run the upgrade command

Ubuntu upgrade from 14.04 LTS to 16.04 failed, [Server] Could not create server upgrade info file at '/var/lib/mysql/'. 2019-04-​25T09:08:08.106750Z 0 [ERROR] [MY-013380] [Server] Failed to  On Ubuntu 16.04, only the latest version of MySQL is included in the APT package repository by default. At the time of writing, that’s MySQL 5.7 To install it, simply update the package index on your server and install the default package with apt-get .

MySQL Bugs: #85759: Upgrade from Ubuntu 14.04 to 16.04 has , [Test case] 1. Install mysql-server in Ubuntu Trusty 2. Edit /etc/mysql/my.cnf and save it (can just add a comment) 3. Upgrade distro to Xenial. Software Updater fails in Ubuntu 16.04. Ask Question Asked 3 years, After running the command sudo apt update && sudo apt upgrade, this is what I see:

8.0.15 to 8.0.16 upgrade fails due to permissions on Ubuntu, When updating from Ubuntu 16.04 to 18.04 we used the for a new Ubuntu release. Please install all available updates for your release before upgrading. Troubleshooting: MySQL/MariaDB Error #1044 & #1045… In this guide, we will cover how to install MySQL 8.0 on Ubuntu 18.04 and 16.04 LTS Server. If you have an old version of MySQL Server (e.g 5.7), you may need to do in-place upgrade or dump all data, upgrade packages and re-import all database data.

Bug #1571865 “mysql fails to start after upgrade if previous def , If you do, it's necessary to uninstall them or follow a slightly more complicated upgrade process (not covered here). Step 1: Install MySQL APT  The only issue after the upgrade may be TIMESTAMP entries. Now, even after an do-release-upgrade to 16.04, mysql is still left at 5.6 and the issues surrounding the non-supported upgrade from 5.5 directly to 5.7 during the release upgrade never even surface. Hope this helps, Kailee.

  • Try asking the question on super-user or ask-ubuntu.
  • Please answer your question