Bug #92025 Feature Request: Perform post-upgrade tasks (such as mysql_upgrade) via RPM
Submitted: 15 Aug 2018 17:49 Modified: 15 Aug 2018 21:10
Reporter: Chris Dillon Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Packaging Severity:S4 (Feature request)
Version:5.7.23 OS:CentOS
Assigned to: CPU Architecture:x86

[15 Aug 2018 17:49] Chris Dillon
Description:
MySQL 5.7.33 changed innodb_index_stats and innodb_table_stats system tables which requires mysql_upgrade to be run.  This action is problematic for automated system package updates because it is not currently performed by the RPM postinstall scriptlets or via some other automated mechanism.

Currently, using a package system to perform automated updates for MySQL is incompatible with this because it requires some manual intervention to complete the upgrade process.

How to repeat:
1) Spin up a CentOS 7 or other supported system and install the MySQL Yum Repository using the following instructions -- this currently defaults to using the 8.0 repo, so disable that and enable the mysql57-community repo instead:

https://dev.mysql.com/downloads/repo/yum/

3) yum-config-manager --disable mysql80-community
4) yum-config-manager --enable mysql57-community
5) yum install mysql-community-server-5.7.22
6) systemctl start mysqld.service # Also verify that datadir was automatically initialized and service is running
7) yum upgrade # This should offer to upgrade to 5.7.23 or later, proceed to do so.
8) Check /var/log/mysqld.log and you should find warnings such as the following:
2018-08-15T16:46:56.272439Z 0 [Warning] InnoDB: Table mysql/innodb_table_stats has length mismatch in the column name table_name.  Please run mysql_upgrade
2018-08-15T16:46:56.272498Z 0 [Warning] InnoDB: Table mysql/innodb_index_stats has length mismatch in the column name table_name.  Please run mysql_upgrade

Suggested fix:
To avoid issues with automated system maintenance any necessary update tasks should be performed during the package update process.  Success of that particular method may be contingent on if mysql_upgrade can automatically authenticate with mysqld, which usually requires additional initial setup steps (such as use of ~/.my.cnf with password).

If it is not possible to automate this process, an alternative is to never make changes in minor MySQL version bumps that require manual intervention to apply.
[15 Aug 2018 18:41] MySQL Verification Team
Thank you for the bug report. Please read:

https://dev.mysql.com/doc/refman/5.7/en/linux-installation.html
https://dev.mysql.com/doc/refman/5.7/en/postinstallation.html

You could ask for a feature request for further development analyze.
[15 Aug 2018 20:24] Chris Dillon
Thanks! I have updated this to be a feature request.
[15 Aug 2018 21:10] MySQL Verification Team
Thank you for the feedback.