Bug #73808 Improve MySQL 5.7 upgrade behaviour to avoid different/more complex upgrade
Submitted: 4 Sep 2014 19:29 Modified: 2 Dec 2014 12:27
Reporter: Simon Mudd (OCA) Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: Installing Severity:S4 (Feature request)
Version:5.7.4 OS:Any
Assigned to: CPU Architecture:Any

[4 Sep 2014 19:29] Simon Mudd
Description:
I just upgraded 5.6.15 to 5.7.4 doing an upgrade of the binaries.

I see on startup of 5.7.4 the following:

2014-09-04T15:21:54.407220Z 0 [Warning] User entry 'aaaaaaaa'@'a.b.c.d' has an empty plugin value. The user will be ignored and no one can login with this user anymore.
2014-09-04T15:21:54.407247Z 0 [Warning] User entry 'root'@'a.b.c.d' has an empty plugin value. The user will be ignored and no one can login with this user anymore.
2014-09-04T15:21:54.407262Z 0 [Warning] User entry 'bbbbbb'@'a.b.c.d' has an empty plugin value. The user will be ignored and no one can login with this user anymore.
2014-09-04T15:21:54.407276Z 0 [Warning] User entry 'cccccc'@'%' has an empty plugin value. The user will be ignored and no one can login with this user anymore.
...

and then trying to run mysql_upgrade I get this:

[root@myhost ~]# mysql_upgrade
Looking for 'mysql' as: mysql
Looking for 'mysqlcheck' as: mysqlcheck
FATAL ERROR: Upgrade failed
[root@myhost ~]# rpm -qa | grep MySQL
MySQL-shared-compat-5.7.4_m14-1.el6.x86_64
MySQL-client-5.7.4_m14-1.el6.x86_64
MySQL-server-5.7.4_m14-1.el6.x86_64
[root@myhost ~]#

Which is rather disheartening.

I expect some noise from a 5.6 to 5.7 upgrade but this doesn't tell me anything useful so I have to search around in a 3400 page manual for the upgrade procedure where it tells me that with 5.7 I have to do things differently from 5.6 and do the following:

1. Stop the server (MySQL 5.6 <<= please be explicit about this)
2. Upgrade MySQL in place (upgrade to MySQL 5.7 binaries, again be specific)
3. Restart the server (be explicit and say MySQL 5.7 server) with the --skip-grant-tables option to disable privilege checking
4. Run mysql_upgrade
5. Restart the server normally (without --skip-grant-tables)

How to repeat:
Upgrade binaries, start the server and try (as previously) to run mysql_upgrade and see it fails.
I did it this way of course because 5.5 to 5.6 upgrades worked that way and I would expect the same upgrade process to work on the next version.

Suggested fix:
This error condition is likely to happen a lot.
The conditions for when it might happen are really obvious.

Other RDBMSES notice when they start "on top of" an old version of the database and do an automatic upgrade, so that the "system" tables are correct. That might be nice for MySQL to do (and disable that behaviour with a special flag) as then nothing needs to be done. You wouldn't need to run mysql_upgrade as the server could upgrade itself (for system tables, like P_S and whatever changes are needed including the grant tables.).
* It should be trivial to recognise the "standard 5.6 grant table setup" or "standard 5.6 p_s setup etc" and making this procedure automatically upgrade the system would be good.

Failing that and as a short term fix, please the grant tables for this situation (no plugins defined for any users) and provide a suitable error message explaining that the user must restart the server with --skip-grant-tables if he's trying to do an upgrade.

So I'd suggest something like:

2014-09-04T15:21:54.407220Z 0 [Warning] All users with SUPER privileges or 'WITH GRANT OPTION' privileges have an empty plugin value so will be unable to login to the server.
2014-09-04T15:21:54.407220Z 0 [Warning] This server's grant tables do match the expected grant table structure for MySQL 5.7.
2014-09-04T15:21:54.407220Z 0 [Warning] If you are upgrading MySQL to MysQL 5.7 you will need to:
2014-09-04T15:21:54.407220Z 0 [Warning] 1. Restart the server, and start it with --skip-grant-tables
2014-09-04T15:21:54.407220Z 0 [Warning] 2. run mysql_upgrade to upgrade the mysql database to the structure required by MySQL 5.7.
2014-09-04T15:21:54.407220Z 0 [Warning] 3. Restart mysql again to allow normal access
2014-09-04T15:21:54.407220Z 0 [Warning] For complete instructions on how to upgrade MySQL to a new version please see section: XXXXX in the MySQL manual.

This explanation explains the situation much more clearly and for most people it's safe to follow the instructions as shown.  It does suggest where to look for more information and so saves people time.

So please consider with 5.7 at least adding a check which will trigger this type of message, but consider if possible maybe getting 5.7 to auto-upgrade the "system" database(s) automatically unless told explicitly not to. with something like [--skip-auto-upgrade-system-tables]
[9 Sep 2014 11:56] Erlend Dahl
Thank you for your report. Verified as described.
[2 Dec 2014 12:27] Erlend Dahl
Fixed as a duplicate of Bug#73026 Upgrade to 5.7 disables user accounts