Bug #24740 mysql_upgrade.exe dies on non-critical errors
Submitted: 30 Nov 2006 23:18 Modified: 23 Jan 2008 14:17
Reporter: David White Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server: Installing Severity:S2 (Serious)
Version:5.0.27 OS:Windows (Windows)
Assigned to: Iggy Galarza CPU Architecture:Any
Tags: upgrade, windows

[30 Nov 2006 23:18] David White
Description:
According to the UNIX script "mysql_fix_privilege_tables", 
-- You can safely ignore all "Duplicate column" and "Unknown column" errors
-- because these just mean that your tables are already up to date.

However, the Windows "mysql_upgrade.exe" script will die if any of those types of errors are encountered. 

How to repeat:
1) Install MySQL 5.0(.27-community-nt)
2) Copy "mysql" database data from MySQL 4.1(.21) into MySQL 5.0's "data/mysql" directory.
3) Start the server
4) Run the "mysql_upgrade.exe" command.  Chances are it may die with an error similar to this:

ERROR 1050 (42S21) at line 22: Duplicate column name 'File_priv'

The script is trying to create a column that already exists.  The error should be ignored and the process continued.  Instead, the program terminates abnormally. 

Suggested fix:
As a workaround, it's still possible to use the old MySQL 4.1 method:

C:\> cd "C:\Program Files\MySQL\MySQL Server 4.1"
C:\> bin\mysql -u root -p mysql
mysql> SOURCE scripts/mysql_fix_privilege_tables.sql

But since that method appears to be deprecated in favor of using mysql_upgrade.exe, that program should be made to not abort on non-critical errors.
[1 Dec 2006 0:04] MySQL Verification Team
Thank you for the bug report.

C:\dbs\5.0\bin>mysql_upgrade --basedir=c:\dbs\5.0
dates.foo                                          OK
db3.t1                                             OK
db3.t2                                             OK
db3.t3                                             OK
dbx.tbx                                            OK
mysql.columns_priv                                 OK
mysql.db                                           OK
mysql.func                                         OK
mysql.help_category                                OK
mysql.help_keyword                                 OK
mysql.help_relation                                OK
mysql.help_topic                                   OK
mysql.host                                         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-0.columns_priv                               OK
mysql-0.db                                         OK
mysql-0.func                                       OK
mysql-0.help_category                              OK
mysql-0.help_keyword                               OK
mysql-0.help_relation                              OK
mysql-0.help_topic                                 OK
mysql-0.host                                       OK
mysql-0.proc                                       OK
mysql-0.procs_priv                                 OK
mysql-0.tables_priv                                OK
mysql-0.time_zone                                  OK
mysql-0.time_zone_leap_second                      OK
mysql-0.time_zone_name                             OK
mysql-0.time_zone_transition                       OK
mysql-0.time_zone_transition_type                  OK
mysql-0.user                                       OK
report.customersep1                                OK
report.dbdsep1                                     OK
test.one                                           OK
test.twoÜ                                          OK
test_dbo.d                                         OK
test_dbo.foo                                       OK
test_dbo.foo1                                      OK
test_dbo.foo2                                      OK
test_dbo.ord                                       OK
test_dbo.ordl                                      OK
test_dbo.t1                                        OK
test_dbo.t2                                        OK
test_dbo.table_name                                OK
test_dbo.tb5                                       OK
test_dbo.tbh                                       OK
test_dbo.test_tab                                  OK
test_dbo.tr                                        OK
test_dbo.usera                                     OK
test_dbo.users                                     OK
test_dbo.users_email                               OK
testb_dbo.agreements_sectionsassoc                 OK
testbug.tbj                                        OK
testbug_dbo.tb1                                    OK
ERROR 1060 (42S21) at line 22: Duplicate column name 'File_priv'

C:\dbs\5.0\bin>
[5 Jan 2007 17:50] Iggy Galarza
I tested for this symptom in 5.0-bk (~5.0.34) and was unable to reproduce it exactly.  Here is the output from my test (only the mysql_fix_privilege_tables.sql portion shown):

ERROR 1060 (42S21) at line 22: Duplicate column name 'File_priv'
@hadGrantPriv:=1
1
1
1
1
1
ERROR 1060 (42S21) at line 28: Duplicate column name 'Grant_priv'
ERROR 1060 (42S21) at line 29: Duplicate column name 'Grant_priv'
ERROR 1060 (42S21) at line 30: Duplicate column name 'Grant_priv'
ERROR 1060 (42S21) at line 41: Duplicate column name 'ssl_type'
ERROR 1061 (42000) at line 66: Duplicate key name 'Grantor'
ERROR 1054 (42S22) at line 102: Unknown column 'Type' in 'columns_priv'
ERROR 1060 (42S21) at line 124: Duplicate column name 'type'
@hadShowDbPriv:=1
1
1
1
1
1
ERROR 1060 (42S21) at line 134: Duplicate column name 'Show_db_priv'
ERROR 1060 (42S21) at line 151: Duplicate column name 'max_questions'
ERROR 1060 (42S21) at line 161: Duplicate column name 'Create_tmp_table_priv'
ERROR 1060 (42S21) at line 164: Duplicate column name 'Create_tmp_table_priv'
ERROR 1054 (42S22) at line 253: Unknown column 'Create_view_priv' in 'where clause'
ERROR 1054 (42S22) at line 288: Unknown column 'Create_routine_priv' in 'where clause'
ERROR 1054 (42S22) at line 337: Unknown column 'Create_user_priv' in 'where clause'
ERROR 1060 (42S21) at line 370: Duplicate column name 'Routine_type'

this matches the output that I got from running `mysql.exe --force mysql < mysql_fix_privilege_tables.sql` (exact duplicate of output shown above).  While the output seems to die, in fact mysql_upgrade.exe runs to completion otherwise  an error message would be output. (See mysql_upgrade.c line 634)  I verified this conclusion by adding the following line to the bottom of mysql_fix_privilege_tables.sql:

SELECT "Finished" AS "This script is:";

and ran both the mysql_upgrade.exe and mysql.exe tests from above.  The output was the same and included the new output.
[21 Feb 2007 7:45] Sveta Smirnova
Bug #26512 was marked as duplicate of this one
[14 Jan 2008 9:43] Hermann Boeken
Same bug appeared for me when upgrading from 4.1.x to 5.0.27.
Why is the status of this bug "Not a Bug"? 
It _is_ a bug, at least in 5.0.27 and on Solaris.
[23 Jan 2008 14:17] Sergei Golubchik
sorry, wrong status. it should be "Cannot repeat", because Iggy "was unable to
reproduce it exactly."

May be the information about how to repeat the bug is not precise enough ? Try to describe *exact* steps that one need to execute to reproduce the bug.