Bug #57925 mysql_upgrade failed wiht FATAL ERROR (5.1.51 > 5.1.52)
Submitted: 2 Nov 2010 12:53 Modified: 9 Nov 2010 20:36
Reporter: Peter Laursen (Basic Quality Contributor) Email Updates:
Status: Won't fix Impact on me:
None 
Category:MySQL Server: Installing Severity:S2 (Serious)
Version:5.1.52 OS:Any (MS Windows 7-64, Linux)
Assigned to: CPU Architecture:Any
Tags: qc

[2 Nov 2010 12:53] Peter Laursen
Description:
C:\Users\Peter>cd \program files\mysql\mysql server 5.1\bin

C:\Program Files\MySQL\MySQL Server 5.1\bin>mysql_upgrade -uroot -p
Enter password: ********
Looking for 'mysql.exe' as: C:\Program Files\MySQL\MySQL Server 5.1\bin\mysql.ex
e
Looking for 'mysqlcheck.exe' as: C:\Program Files\MySQL\MySQL Server 5.1\bin\mys
qlcheck.exe
Running 'mysqlcheck' with connection arguments: "--port=3306"
Running 'mysqlcheck' with connection arguments: "--port=3306"
C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqlcheck.exechtest.forfull
                             OK
: formstest.t1                                       OK
Got error: 1102: Incorrect database name '' when executing 'CHECK TABLE ...  FOR
 UPGRADE'mysql.columns_priv                                 OK

mysql.db                                           OK
mysql.event                                        OK
mysql.func                                         OK
mysql.general_log
Error    : You can't use locks with log tables.
status   : OK
mysql.help_category                                OK
mysql.help_keyword                                 OK
mysql.help_relation                                OK
mysql.help_topic                                   OK
mysql.host                                         OK
mysql.ndb_binlog_index                             OK
mysql.plugin                                       OK
mysql.proc                                         OK
mysql.procs_priv                                   OK
mysql.servers                                      OK
mysql.slow_log
Error    : You can't use locks with log tables.
status   : OK
mysql.tables_priv                                  OK
mysql.time_zone                                    OK
mysql.time_zone_leap_second                        OK
mysql.time_zone_name                               OK
mysql.time_zone_transition                         OK
mysql.time_zone_transition_type                    OK
mysql.user                                         OK
sourcebase.t1                                      OK
targetbase.t1                                      OK
test.111111                                        OK
FATAL ERROR: Upgrade failed

C:\Program Files\MySQL\MySQL Server 5.1\bin>

How to repeat:
This is the offending one I think:

Got error: 1102: Incorrect database name '' when executing 'CHECK TABLE ...  FOR
 UPGRADE'mysql.columns_priv  

I understand that dabasename `mysql` was not prefixed the table name. 

(this Error: "You can't use locks with log tables." is another issue reported elsewhere so ignore this here).

Suggested fix:
I do not know if 5.1.52 is officially out - I took from a FTP-mirror (though official).

But thought I should report this whether it is announced or not. I have set as "S2" (even though that mysql_upgrade is probably not really required when upgrading from 5.1.51 to 5.1.52 - but possibly the error will also occur when upgrading from older versions)
[2 Nov 2010 13:40] Valeriy Kravchuk
I do not see this problem locally:

C:\Program Files\MySQL\MySQL Server 5.1\bin>mysql_upgrade.exe -uroot -proot -P33
10
Looking for 'mysql.exe' as: C:\Program Files\MySQL\MySQL Server 5.1\bin\mysql.ex
e
Looking for 'mysqlcheck.exe' as: C:\Program Files\MySQL\MySQL Server 5.1\bin\mys
qlcheck.exe
Running 'mysqlcheck' with connection arguments: "--port=3310" "--port=3310"
Running 'mysqlcheck' with connection arguments: "--port=3310" "--port=3310"
db1.tab1                                           OK
db1.tinno1                                         OK
mysql.application_account                          OK
mysql.columns_priv                                 OK
mysql.db                                           OK
mysql.event                                        OK
mysql.func                                         OK
mysql.general_log
Error    : You can't use locks with log tables.
status   : OK
mysql.help_category                                OK
mysql.help_keyword                                 OK
mysql.help_relation                                OK
mysql.help_topic                                   OK
mysql.host                                         OK
mysql.ndb_binlog_index                             OK
mysql.plugin                                       OK
mysql.proc                                         OK
mysql.procs_priv                                   OK
mysql.servers                                      OK
mysql.slow_log
Error    : You can't use locks with log tables.
status   : OK
mysql.tables_priv                                  OK
mysql.time_zone                                    OK
mysql.time_zone_leap_second                        OK
mysql.time_zone_name                               OK
mysql.time_zone_transition                         OK
mysql.time_zone_transition_type                    OK
mysql.user                                         OK
mysql.user_info                                    OK
...
[2 Nov 2010 13:57] Peter Laursen
so what we do now?
[2 Nov 2010 14:17] Peter Laursen
I tried again and get the same error

I also notice from console output that not all tables are checked.  I have some with very 'silly' (but valid as of 5.1) names for some tables and lots of empty tables.  Nothing important stored here (only short stupid test cases) so I can share everything

1)
I can dump everything on this server for you

C:\Program Files\MySQL\MySQL Server 5.1\bin>mysqldump --all-databases --routines
 --events -uroot -p > c:\dump.sql .. (around 300 KB zipped)

2)
Or I can provide the complete /datadir (700 KB zipped with everything - logs etc.)
[2 Nov 2010 14:30] Peter Laursen
One more piece of information: data folder has a file named "mysql_upgrade_info" and it reads "5.1.50" - so I probably never executed upgrade 5.1.50 > 5.1.51
[3 Nov 2010 11:19] Sveta Smirnova
Thank you for the feedback.

Yes, please provide dump or datadir compressed.
[3 Nov 2010 11:54] Peter Laursen
compressed /datadir uploaded to anonymous FTP.  File name "peter_data.zip".
[3 Nov 2010 12:46] Sveta Smirnova
Thank you for the feedback.

Verified as described: it stops working after table named

test/@002etable.frm
[3 Nov 2010 12:58] Peter Laursen
OK .. then the original issue may not be a mysql_upgrade issue.  I may have had such table before, but DROP TABLE may have failed to remove teh .frm
[3 Nov 2010 13:04] Peter Laursen
after deleting the offending .frm file mysql_upgrade succeeded.
[9 Nov 2010 20:21] Konstantin Osipov
Thank you for your bug report. mysql_upgrade will not be extended to handle the situation with partially dropped table present in the data directory.
[9 Nov 2010 20:36] Peter Laursen
No issue! But wouldn't it be interesting to (try to) reproduce how 'partially dropped tables' can occur?