Ubuntu: Ubuntu 16.04 : can t apt due to mysql-server-5.7 issue


I'm trying to install / update packages and everytime the process fails because of a mysql-server error :

    sudo apt install graylog-server      Lecture des listes de paquets... Fait      Construction de l'arbre des dépendances             Lecture des informations d'état... Fait      graylog-server is already the newest version (2.0.3-1).      0 mis à jour, 0 nouvellement installés, 0 à enlever et 10 non mis à jour.      2 partiellement installés ou enlevés.      Après cette opération, 0 o d'espace disque supplémentaires seront utilisés.      Souhaitez-vous continuer ? [O/n] o      Paramétrage de mysql-server-5.7 (5.7.12-0ubuntu1.1) ...      Checking if update is needed.      Checking server version.      Running queries to upgrade MySQL server.      mysql_upgrade: (non fatal) [ERROR] 1545: Failed to open mysql.event      Checking system database.      mysql.column_stats                                 OK      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.gtid_slave_pos                               OK      mysql.help_category                                OK      mysql.help_keyword                                 OK      mysql.help_relation                                OK      mysql.help_topic                                   OK      mysql.host                                         OK      mysql.index_stats                                  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.roles_mapping                                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.table_stats                                  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.0).      Found 0 sys functions, but expected 21. Re-installing the sys schema.      Upgrading the sys schema.      mysql_upgrade: [ERROR] 1136: Column count doesn't match value count at row 1      mysql_upgrade failed with exit status 5      dpkg: erreur de traitement du paquet mysql-server-5.7 (--configure) :       le sous-processus script post-installation installé a retourné une erreur de sortie d'état 1      Aucun rapport « apport » n'a été créé car le message d'erreur indique une erreur consécutive à un échec précédent.                                                                                                                        dpkg: des problèmes de dépendances empêchent la configuration de mysql-server :       mysql-server dépend de mysql-server-5.7 ; cependant :       Le paquet mysql-server-5.7 n'est pas encore configuré.        dpkg: erreur de traitement du paquet mysql-server (--configure) :       problèmes de dépendances - laissé non configuré      Des erreurs ont été rencontrées pendant l'exécution :       mysql-server-5.7       mysql-server      E: Sub-process /usr/bin/dpkg returned an error code (1)  

I did purge and reinstall mysql-server, I even set password to null without expiration for debian-sys-maint ( it's on a dev computer so no sensitive data ) but the issue still remains.

I don't know how to solve it and it's very annoyince since now I can't even update my system because this process is involved every time.

Thanks for you help !


I managed to fix this without having to purge everything. It seems the problem is that the sys schema database was never created, so here's the solution:

  • Clone https://github.com/mysql/mysql-sys and cd into the cloned folder.
  • In a terminal, run mysql -u root -p < ./sys_57.sql (or sys_56.sql, depending on your version)
  • Enjoy mysql_upgrade working again.

I guess this probably was, as @skerit said, an upgrading scripts mess-up.


Someone messed up the upgrade scripts, and in an LTS release no less.

The main problem lies in the upgrading of the system schema. If you don't want to delete all your data, you can force the update like this:

mysql_upgrade -uroot -p --verbose --skip-sys-schema  

This is a dirty workaround, of course, since the system schema is now not what it's supposed to be, but at least you can continue using mysql.


I finally remove everything mysql components ( mysql-server, mysql-server-5.7, mysql-server-core-5.7 ) and data ( /var/lib/mysql , /etc/mysql ) and do a fresh install of it .

Everythings works fine now.

I thing the mysql internal dbs were somehow corrupted or with data missing during the migration from 5.6 to 5.7 ( from the change log , the column password from user table has been deleted for a new one )

hope it will help

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »