Bug #57551 Live upgrade fails between 5.1.52 -> 5.5.7-rc
Submitted: 19 Oct 2010 6:40 Modified: 15 Dec 2010 1:17
Reporter: Nidhi Shrotriya Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Security: Privileges Severity:S3 (Non-critical)
Version:5.5.7-rc OS:Any
Assigned to: Georgi Kodinov CPU Architecture:Any

[19 Oct 2010 6:40] Nidhi Shrotriya
Description:
Live upgrade between 5.1.52 to 5.5.7-rc fails with:
101019  8:26:46 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.proxy_priv' doesn't exist

How to repeat:
Start 5.1.52 server as below:
scripts/mysql_install_db --no-defaults
bin/mysqld_safe --no-defaults --socket=/tmp/mysql1.sock --port=3310 &
Shutdown 5.1.52 server. 

Start 5.5.7-rc as below (with datadir created by 5.1.52)
bin/mysqld_safe --no-defaults --socket=/tmp/mysql2.sock --port=3311 --datadir=$PWD/../mysql_adv_5152/data &

fails.

Error in server log:
101019  8:26:46 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.proxy_priv' doesn't exist
[19 Oct 2010 9:04] Nidhi Shrotriya
Same on 5.5.6-rc -> 5.5.7-rc upgrade.
[19 Oct 2010 10:31] Nidhi Shrotriya
Workaround is to:
- Remove 'mysql' db dir. created by old server, run mysql_install_db with new server and now start the new server.
[19 Oct 2010 11:56] Georgi Kodinov
Nidhi,

According to mysql's documentation http://dev.mysql.com/doc/refman/5.5/en/upgrading.html one is supposed to run the mysql_upgrade when re-using a database created by an old server version with a server of a later version.

Does running mysql_upgrade fix the problem ?
[19 Oct 2010 14:47] Omer Barnir
The new server needs to be started so you can run 'mysql_upgrade'. The above seems to be happening with that initial start.
Also: the suggested workaround is not valid as it 'invalidates' the upgrade of the steps and will remove 'customizations' done in the old server (users, triggered etc.).
[21 Oct 2010 14:11] Paul Dubois
"Does running mysql_upgrade fix the problem ?"

No because mysql_upgrade requires that you be able to start the server first. The nature of the problem is such that as soon as you upgrade from *any* release earlier than 5.5.7, your server is dead. It exits after detecting the missing proxy_priv table, rather than doing something less catastrophic such as issuing a warning, disabling proxy capabilities, and continue the startup process.

So any user who performs a binary upgrade to 5.5.7 will have a dead installation.
[26 Oct 2010 15:45] Paul Dubois
Note to be added to 5.5.7 changelog:

For this release, the server requires that a new grant table,
proxy_priv, be present in the mysql database. If you are upgrading
from a previous MySQL release rather than performing a new
installation, the server will exit during startup after finding that
this table is missing. To create the table, start the server with the
--skip-grant-tables option to cause it to skip the normal grant table
checks, then run mysql_upgrade. For example:

shell> mysqld --skip-grant-tables & 
shell> mysql_upgrade 

Then stop the server and restart it normally.

You can specify other options on the mysqld command line if
necessary. Alternatively, if your installation is configured so that
the server normally reads options from an option file, use the 
--defaults-file option to specify the file (enter each command on a
single line):

shell> mysqld --defaults-file=/usr/local/mysql/etc/my.cnf
         --skip-grant-tables &
shell> mysql_upgrade
[18 Nov 2010 11:39] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/124240

3128 Georgi Kodinov	2010-11-18
      Bug #57551: Live upgrade fails between 5.1.52 -> 5.5.7-rc
      
      Updated the server to treat a missing mysql.proxies_priv table 
      as empty. 
      Added some grants to make sure tables are correctly opened
      when they must be opened.
      Fixed a mysql_upgrade omission not adding rights to root to 
      execute GRANT PROXY on other users.
      Added a test case for the above.
[19 Nov 2010 11:12] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/124416

3128 Georgi Kodinov	2010-11-19
      Bug #57551: Live upgrade fails between 5.1.52 -> 5.5.7-rc
      
      Updated the server to treat a missing mysql.proxies_priv table 
      as empty. 
      Added some grants to make sure tables are correctly opened
      when they must be opened.
      Fixed a mysql_upgrade omission not adding rights to root to 
      execute GRANT PROXY on other users.
      Added a test case for the above.
      Fixed error handling code to close the cursor
[19 Nov 2010 13:06] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/124440

3128 Georgi Kodinov	2010-11-19
      Bug #57551: Live upgrade fails between 5.1.52 -> 5.5.7-rc
      
      Updated the server to treat a missing mysql.proxies_priv table 
      as empty. 
      Added some grants to make sure tables are correctly opened
      when they must be opened.
      Fixed a mysql_upgrade omission not adding rights to root to 
      execute GRANT PROXY on other users.
      Removed a redundant CREATE TABLE from 
      mysql_system_tables_fix.sql since it's always executed after
      mysql_system_tables.sql and the first file has CREATE TABLE 
      in it. 
      Added a test case for the above.
      Fixed error handling code to close the cursor
[19 Nov 2010 14:13] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/124457

3128 Georgi Kodinov	2010-11-19
      Bug #57551: Live upgrade fails between 5.1.52 -> 5.5.7-rc
      
      Updated the server to treat a missing mysql.proxies_priv table 
      as empty. 
      Added some grants to make sure tables are correctly opened
      when they must be opened.
      Fixed a mysql_upgrade omission not adding rights to root to 
      execute GRANT PROXY on other users.
      Removed a redundant CREATE TABLE from 
      mysql_system_tables_fix.sql since it's always executed after
      mysql_system_tables.sql and the first file has CREATE TABLE 
      in it. 
      Added a test case for the above.
      Fixed error handling code to close the cursor
[19 Nov 2010 14:15] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/124458

3134 Georgi Kodinov	2010-11-19
      Bug #57551: Live upgrade fails between 5.1.52 -> 5.5.7-rc
      
      Updated the server to treat a missing mysql.proxies_priv table 
      as empty. 
      Added some grants to make sure tables are correctly opened
      when they must be opened.
      Fixed a mysql_upgrade omission not adding rights to root to 
      execute GRANT PROXY on other users.
      Removed a redundant CREATE TABLE from 
      mysql_system_tables_fix.sql since it's always executed after
      mysql_system_tables.sql and the first file has CREATE TABLE 
      in it. 
      Added a test case for the above.
      Fixed error handling code to close the cursor
[19 Nov 2010 14:35] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/124462

3134 Georgi Kodinov	2010-11-19
      Bug #57551: Live upgrade fails between 5.1.52 -> 5.5.7-rc
      
      Updated the server to treat a missing mysql.proxies_priv table 
      as empty. 
      Added some grants to make sure tables are correctly opened
      when they must be opened.
      Fixed a mysql_upgrade omission not adding rights to root to 
      execute GRANT PROXY on other users.
      Removed a redundant CREATE TABLE from 
      mysql_system_tables_fix.sql since it's always executed after
      mysql_system_tables.sql and the first file has CREATE TABLE 
      in it. 
      Added a test case for the above.
      Fixed error handling code to close the cursor
[5 Dec 2010 12:41] Bugs System
Pushed into mysql-trunk 5.6.1 (revid:alexander.nozdrin@oracle.com-20101205122447-6x94l4fmslpbttxj) (version source revid:alexander.nozdrin@oracle.com-20101205122447-6x94l4fmslpbttxj) (merge vers: 5.6.1) (pib:23)
[15 Dec 2010 1:17] Paul Dubois
Noted in 5.5.8 changelog.

For an upgrade to MySQL 5.5.7 from a previous release, the server
exited if the mysql.proxies_priv table did not exist, making upgrades
inconvenient. Now the server treats a missing proxies_priv table as
equivalent to an empty table. However, after starting the server, you 
should still run mysql_upgrade to create the table.
[16 Dec 2010 22:31] Bugs System
Pushed into mysql-5.5 5.5.9 (revid:jonathan.perkin@oracle.com-20101216101358-fyzr1epq95a3yett) (version source revid:jonathan.perkin@oracle.com-20101216101358-fyzr1epq95a3yett) (merge vers: 5.5.9) (pib:24)