Bug #31064 mysql_upgrade.exe fails
Submitted: 17 Sep 2007 16:00 Modified: 2 Dec 2009 14:03
Reporter: Peter Brawley (Basic Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Documentation Severity:S2 (Serious)
Version:5.1.21,6.0 OS:Any
Assigned to: MC Brown CPU Architecture:Any
Tags: qc

[17 Sep 2007 16:00] Peter Brawley
Description:
mysql_upgrade fails with the error msg "Failed to create temporary file for defaults".

How to repeat:
F:\Program Files\MySQL\MySQL Server 5.1\bin>mysql_upgrade
Looking for 'mysql.exe' in: F:\Program Files\MySQL\MySQL Server 5.1\bin\mysql.ex
e
Looking for 'mysqlcheck.exe' in: F:\Program Files\MySQL\MySQL Server 5.1\bin\mys
qlcheck.exe
FATAL ERROR: Failed to create temporary file for defaults

Suggested fix:
IIRC I reported this for a previous version, but the bug no longer appears on my list, and in any case the bug remains.
[17 Sep 2007 16:22] MySQL Verification Team
Thank you for the bug report. I can't repeat what is the output of
echo "%temp%" on your environment?. Thanks in advance.

C:\Program Files (x86)\MySQL\MySQL Server 5.1\bin>mysql_upgrade
Looking for 'mysql.exe' in: C:\Program Files (x86)\MySQL\MySQL Server 5.1\bin\mysql.exe
Looking for 'mysqlcheck.exe' in: C:\Program Files (x86)\MySQL\MySQL Server 5.1\bin\mysqlcheck.exe
Running 'mysqlcheck'...
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.plugin                                       OK
mysql.proc                                         OK
mysql.procs_priv                                   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
Running 'mysql_fix_privilege_tables'...
OK

C:\Program Files (x86)\MySQL\MySQL Server 5.1\bin>echo "%temp%"
"C:\Users\miguel\AppData\Local\Temp"

C:\Program Files (x86)\MySQL\MySQL Server 5.1\bin>
[17 Sep 2007 16:25] Peter Brawley
F:\Program Files\MySQL\MySQL Server 5.1\bin>echo %temp%
F:\DOCUME~1\ADMINI~1\LOCALS~1\Temp
[17 Sep 2007 16:34] Peter Brawley
Trying to get round this old problem by running mysql_fix_privilege_tables.sql fails to fix the events system. After running that script, which updates mysql.event, querying information_schema.events still raises an error:

localhost.mysql>select * from information_schema.events;
ERROR 1574 (HY000): Cannot proceed because system tables used by Event Scheduler
 were found damaged at server start

One would have thought that these problems would have been solved by now.
[18 Sep 2007 16:39] MySQL Verification Team
The 5.1.21 install it was an upgrade installation?. If yes what was the prior
version?. Thanks in advance.
[18 Sep 2007 17:14] Peter Brawley
Upgrade from 5.1.19 to 5.1.21
[24 Sep 2007 23:23] MySQL Verification Team
Thank you for the feedback.

c:\mysql-5.1.21-beta-win32>bin\mysql_upgrade
Looking for 'mysql.exe' in: c:\mysql-5.1.21-beta-win32\bin\mysql.exe
Looking for 'mysqlcheck.exe' in: c:\mysql-5.1.21-beta-win32\bin\mysqlcheck.exe
FATAL ERROR: Failed to create temporary file for defaults
[1 Oct 2007 15:37] Peter Brawley
On 5.1.22 this still fails with

FATAL ERROR: Failed to create temporary file for defaults
[13 Dec 2007 17:58] Iggy Galarza
I installed MySQL 5.1.19-beta using an MSI package from the dev.mysql.com archive.  I used all the defaults during installation.  The reported version is:  5.1.19-beta-community-nt-debug

Immediately after installing, I ran mysql_upgrade with no params and got:

C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqlcheck.exe: Got error: 1045: Acc
ess denied for user 'root'@'localhost' (using password: NO) when trying to conne
ct
FATAL ERROR: Upgrade failed

Adding username and passowrd.
C:\Program Files\MySQL\MySQL Server 5.1\bin>mysql_upgrade.exe -uroot -p
Enter password: ****
Looking for 'mysql.exe' in: C:\Program Files\MySQL\MySQL Server 5.1\bin\mysql.exe
Looking for 'mysqlcheck.exe' in: C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqlcheck.exe
Running 'mysqlcheck'...
mysql.columns_priv                                 OK
mysql.db                                           OK
mysql.event                                        OK
mysql.func                                         OK
mysql.general_log                                  OK
mysql.help_category                                OK
mysql.help_keyword                                 OK
mysql.help_relation                                OK
mysql.help_topic                                   OK
mysql.host                                         OK
mysql.plugin                                       OK
mysql.proc                                         OK
mysql.procs_priv                                   OK
mysql.slow_log                                     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
Running 'mysql_fix_privilege_tables'...
OK

Next I downloaded the ZIP file mysql-5.1.23-beta-GIS-GIS-win32.zip and ran it's  Setup.exe to upgrade the 5.1.19 server installation.  The new version is: 5.1.23-beta-GIS

After renaming mysqld .exe, .pdb and .map to mysqld-nt (keeping the extensions) I was able to start the service and here is the output of mysql_upgrade:

C:\Program Files\MySQL\MySQL Server 5.1\bin>mysql_upgrade -uroot -p
Enter password: ****
Looking for 'mysql.exe' in: C:\Program Files\MySQL\MySQL Server 5.1\bin\mysql.exe
Looking for 'mysqlcheck.exe' in: C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqlcheck.exe
Running 'mysqlcheck'...
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
Running 'mysql_fix_privilege_tables'...
OK

Next, I re-ran the test (in a clean environment) except I downloaded the current community version 5.1.22 in the file mysql-essential-5.1.22-rc-win32.msi and was able to successfully run mysql_upgrade w/o error.

Last, I re-ran the test a thrid time.  This time I installed 5.1.19 from the MSI named above and attempted to upgrade with the mysql_upgrade from the noinstall version of 5.1.22.  This worked without problem.

Please provide more details on the steps to reproduce the problem.  Which package of 5.1.19 should I start with?  Which package of 5.1.22 did you use to reproduce the problem?  Do you recognize any differences in the test I'm running and your steps to reproduce?
[14 Jan 2008 0:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
[30 Apr 2008 12:29] Philip Stoev
This bug remains in 6.0.4/6.0.5 To reproduce:

1. Download and unpack 6.0.4
2. Start server

$ cd mysql-test
$ perl mysql-test-run.pl --start-and-exit --skip-ndb

3. Run mysql_upgrade

$ ../bin/mysql_upgrade -uroot --socket=var/tmp/master.sock

Looking for 'mysql' in: /build/6.0.4a/bin/mysql
Looking for 'mysqlcheck' in: /build/6.0.4a/bin/mysqlcheck
Running 'mysqlcheck'...
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
Running 'mysql_fix_privilege_tables'...
OK
[30 Apr 2008 12:43] Iggy Galarza
Hi Phillip,

  The log you showed appears to have been successful. mysql_upgrade's output appears complete and does not show the error message "FATAL ERROR: Failed to create temporary file for defaults". This error message is the symptom of this bug, the others are normal.

~Iggy
[30 Apr 2008 13:20] Philip Stoev
I am sorry, the last comment applies to the error message "You can't use locks with log tables", not to the original message that is reported in the bug.
[30 May 2008 23:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
[8 Mar 2009 3:13] P Murukesan
I am also facing the same problem i have installed mysql-5.1.31-win32

when i run mysqlcheck command the following output got

all-databases                     FALSE
all-in-1                          FALSE
auto-repair                       FALSE
character-sets-dir                (No default value)
compress                          FALSE
databases                         FALSE
debug-check                       FALSE
debug-info                        FALSE
default-character-set             (No default value)
fast                              FALSE
fix-db-names                      FALSE
fix-table-names                   FALSE
force                             FALSE
extended                          FALSE
host                              (No default value)
write-binlog                      TRUE
port                              0
quick                             FALSE
shared-memory-base-name           (No default value)
silent                            FALSE
socket                            (No default value)
ssl                               FALSE
ssl-ca                            (No default value)
ssl-capath                        (No default value)
ssl-cert                          (No default value)
ssl-cipher                        (No default value)
ssl-key                           (No default value)
ssl-verify-server-cert            FALSE
use-frm                           FALSE
user                              (No default value)
[8 Mar 2009 4:21] Peter Brawley
On 27 Dec 2007  Iggy Galarza was unable to reproduce this bug on his test machine. Apparently this was thought a good reason to close the bug. 

The bug remains on 5.1.32, whether Iggy was able to reproduce it or not.
[13 Mar 2009 14:48] MySQL Verification Team
Back to verified:

c:\mysql-5.1.32-winx64>bin\mysql_upgrade.exe
Looking for 'mysql.exe' as: c:\mysql-5.1.32-winx64\bin\mysql.exe
Looking for 'mysqlcheck.exe' as: c:\mysql-5.1.32-winx64\bin\mysqlcheck.exe
FATAL ERROR: Failed to create temporary file for defaults

c:\mysql-5.1.32-winx64>
[2 Dec 2009 14:03] MC Brown
I've added a note to the 5.1, 5.4, and 5.5 manuals to explain that mysql_upgrade must be run as a user with administrator privileges.