Search Suggest

المشاركات

[SOLVED] Column count of mysql.user is wrong. Expected 42, found 39. The table is probably corrupted

I was stumped by this error for a few hours:

Column count of mysql.user is wrong. Expected 42, found 39. The table is probably corrupted

After wasting a few hours, I finally remember that my server was an upgraded version of MySQL.
And I was using a data structure from a older mysql server. So, there are possible inconsistent database table structure, namely the system table called 'mysql' table.

The solution to solve this issue was surprisingly simple. This single line command solved my issue:

mysql_upgrade --force -uroot -p 


The output from this command look like this:

mysql.columns_priv                                 OKmysql.db                                           OKmysql.event                                        OKmysql.func                                         OKmysql.general_log                                  OKmysql.help_category                                OKmysql.help_keyword                                 OKmysql.help_relation                                OKmysql.help_topic                                   OKmysql.host                                         OKmysql.ndb_binlog_index                             OKmysql.plugin                                       OKmysql.proc                                         OKmysql.procs_priv                                   OKmysql.proxies_priv                                 OKmysql.servers                                      OKmysql.slow_log                                     OKmysql.tables_priv                                  OKmysql.time_zone                                    OKmysql.time_zone_leap_second                        OKmysql.time_zone_name                               OKmysql.time_zone_transition                         OKmysql.time_zone_transition_type                    OKmysql.user                                         OKRunning 'mysql_fix_privilege_tables'...OK

إرسال تعليق