简体   繁体   中英

Upgrade fails with mysql.user wrong column count and expired password

I moved from mariadb to mysql (which worked). Now I wanted to upgrade mysql to 5.7 but it threw an error:

Running queries to upgrade MySQL server.
mysql_upgrade: (non fatal) [ERROR] 1728: Cannot load from mysql.proc. The table is probably corrupted
mysql_upgrade: (non fatal) [ERROR] 1545: Failed to open mysql.event
mysql_upgrade: [ERROR] 1072: Key column 'Id' doesn't exist in table
mysql_upgrade failed with exit status 5

I wanted to run mysqlcheck but it threw error:

Your password has expired. To log in you must change it using a client that supports expired passwords.

When I log in as root and want to SET PASSWORD I get this error

Column count of mysql.user is wrong. Expected 45, found 46.

When I want to start mysql with ignoring grant tables with

mysqld --skip-grant-tables

It fails silently.

What else can I try here? Reinstalling mysql results in the same

Key column 'Id' doesn't exist in table
installed mysql-server-5.7 package post-installation script subprocess returned error exit status 1
No apport report written because the error message indicates its a followup error from a previous failure.
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

error.

I added skip-grant-tables to my.cnf and issued:

ALTER TABLE mysql.user DROP COLUMN is_role;

that deleted the extra column. Now I was able to update my passowrd again. The remaining problem is the following. Apt is stuck on unconfigured packages. If apt wants to configure them it issues mysql_upgrade which will fail with "Key column 'Id' doesn't exist in table". It does not provide any other information. How can I debug this?

Then I used logging of mysql queries as @Piemol suggested to trace the last query. The last query of msql_upgrade is:

ALTER TABLE slave_worker_info ADD Channel_name CHAR(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT 'The channel on which the slave is connected to a source. Used in Multisource Replication', DROP PRIMARY KEY, ADD PRIMARY KEY(Channel_name, Id)
Quit

slave_worker_info had no column ID, so I dropped the table (as it was empty) and created it again ( https://dba.stackexchange.com/questions/54608/innodb-error-table-mysql-innodb-table-stats-not-found-after-upgrade-to-mys )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM