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 :
    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 !


4 Answers 4


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.

  • This worked but I had to login to mysql and run the sql file using the source command. Dec 15, 2016 at 8:26
  • So, this has happened again to me, using Ubuntu 17.04. This time apparently it's a type mismatch of the last_update column in the internal mysql.innodb_index_stats table. I don't know if it's the packager's, MySQL's or someone else's fault, but my recommendation after my experience with MySQL since 16.04 is that you migrate to MariaDB as soon as you can. Like, tomorrow if possible.
    – Marc
    Jul 31, 2017 at 1:51
  • I have had problems with MariaDb as well as its basically the same as MySQL. Most new stuff I am doing is in PostgreSQL. Aug 1, 2017 at 16:35
  • This is still happening in Ubuntu 17.10... I upgraded Ubuntu for the sole reason to get rid of this annoyance.... FFS UBUNTU! Jan 26, 2018 at 6:17

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.

  • 1
    Yeah the idiots at mysql screwed up
    – tread
    Feb 25, 2017 at 14:37

I removed only /var/lib/mysql/sys dir and then ran this command:

mysql_update -u root -p

All went fine.


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

  • I recommend editing this answer to expand it with specific details about how to do this. (See also How do I write a good answer? for general advice about what sorts of answers are considered most valuable on AskUbuntu.) Oct 25, 2016 at 23:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .