Bug #41057 mysql_update fails FATAL ERROR: Failed to create temporary file for defaults
Submitted: 26 Nov 2008 15:18 Modified: 18 Jun 2010 1:08
Reporter: Dave Pullin (Basic Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.1.29-rc OS:Windows (windows 2KSP4)
Assigned to: Georgi Kodinov CPU Architecture:Any
Tags: qc

[26 Nov 2008 15:18] Dave Pullin
Description:
Bug http://bugs.mysql.com/bug.php?id=28606 which was closed as a duplicate of 
http://bugs.mysql.com/bug.php?id=28774 which is closed (1 Nov 2007) still occurs in 5.1.29-rc

E:\pgm\mysql\bin>mysql_upgrade
Looking for 'mysql.exe' as: E:\pgm\mysql\bin\mysql.exe
Looking for 'mysqlcheck.exe' as: E:\pgm\mysql\bin\mysqlche
FATAL ERROR: Failed to create temporary file for defaults

How to repeat:
Invoke mysql_upgrade.exe
[10 Dec 2008 20:13] Sveta Smirnova
Thank you for the report.

Verified as described in comment "[26 Jun 2007 21:50] Sveta Smirnova" to bug #28606: create user "guest", then try to mysql_upgrade.
[9 Jan 2009 9:00] Lukas Nevosad
To workaround this bug, run mysql_upgrade.exe as Administrator.
[6 Mar 2009 5:46] Peter Brawley
On 23 May 2007 I reported this bug for 5.1.18 and 5.1.19, for  a server running Windows 2000 SP4. On 29 Jun 2007 that bug report was labelled a duplicate for bug 28774 (filed one week after I had done). On 18 Oct 2007 the bug page for #28774 reported that a fix had been pushed 5.1.23-beta and 5.0.52. The bug has been marked closed.

As of 5.1.32, there is no evidence that the mysql_upgrade bug has been corrected. Executing mysql_upgrade.exe still leads to this:

mysql_upgrade
Looking for 'mysql.exe' as: F:\Program Files\MySQL\MySQL Server 5.1\bin\mysql.exe
Looking for 'mysqlcheck.exe' as: F:\Program Files\MySQL\MySQL Server 5.1\bin\mysqlcheck.exe
FATAL ERROR: Failed to create temporary file for defaults

Neither has the associated bug in mysql_fix_privilege_tables.sql been fixed:

use mysql;
Database changed
source f:\tmp\mysql_fix_privilege_tables.sql;
Outfile disabled.
ERROR:
Unknown command '\m'.
ERROR:
Failed to open file 'f:mp\mysql_fix_privilege_tables.sql', error: 2
[6 Mar 2009 18:13] Peter Brawley
I should add that under Windows 2000 Pro SP4, the bug occurs when mysql_upgrade.exe is run by Administrator.

Running it as Administrator is NOT a workaround.
[8 Mar 2009 2:48] P Murukesan
I have installed the mysql version mysql-5.1.31-win32 .but still the problem exist .Please provide the work around solution for this .Waiting for your replay
[29 Apr 2009 23:49] Dave Armour
For what its worth, I was having exactly the same problem as Peter Brawley with mysql_upgrade on my W2KPRO box. After many attempts, I successfully tried using a tmpdir command line parameter:
I:\Program Files\MySQL\Server 5.1\bin>mysql_upgrade --tmpdir=I: -p******
[9 Mar 2010 9:21] 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/102661

3369 Georgi Kodinov	2010-03-09
      Bug #41057: mysql_update fails FATAL ERROR: Failed to create temporary file for defaults
      
      mysql_upgrade was passing an non-initialized non-null tmpdir to create_temp_file() if no 
      --tmpdir was specified. This prevents create_temp_file() from taking the system 
      temporary file path and as a result mysql_upgrade was trying to open a file in a 
      directory that it may not have write access to.
      Fixed by making sure mysql_upgrade will pass a zero length temp dir string to 
      create_temp_file() if no --tmpdir is specified.
[9 Mar 2010 16:23] 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/102752

3380 Georgi Kodinov	2010-03-09
      Bug #41057: mysql_update fails FATAL ERROR: Failed to create temporary file for defaults
      
      mysql_upgrade was passing an non-initialized non-null tmpdir to create_temp_file() if no 
      --tmpdir was specified. This prevents create_temp_file() from taking the system 
      temporary file path and as a result mysql_upgrade was trying to open a file in a 
      directory that it may not have write access to.
      Fixed by making sure mysql_upgrade will pass a zero length temp dir string to 
      create_temp_file() if no --tmpdir is specified.
[26 Mar 2010 8:20] Bugs System
Pushed into 5.5.4-m3 (revid:alik@sun.com-20100326080914-2pz8ns984e0spu03) (version source revid:alexey.kopytov@sun.com-20100312095153-t4rtoqc7p96lmxvh) (merge vers: 5.5.3-m2) (pib:16)
[26 Mar 2010 8:24] Bugs System
Pushed into mysql-next-mr (revid:alik@sun.com-20100326081116-m3v4l34yhr43mtsv) (version source revid:alik@sun.com-20100325072612-4sds00ix8ajo1e84) (pib:16)
[26 Mar 2010 8:28] Bugs System
Pushed into 6.0.14-alpha (revid:alik@sun.com-20100326081944-qja07qklw1p2w7jb) (version source revid:alik@sun.com-20100325073410-4t4i9gu2u1pge7xb) (merge vers: 6.0.14-alpha) (pib:16)
[6 Apr 2010 7:59] Bugs System
Pushed into 5.1.46 (revid:sergey.glukhov@sun.com-20100405111026-7kz1p8qlzglqgfmu) (version source revid:joro@sun.com-20100310101949-xa8rg9ep9qawuhvb) (merge vers: 5.1.45) (pib:16)
[15 Apr 2010 15:41] Paul DuBois
Noted in 5.1.46, 5.5.5, 6.0.14 changelogs.

mysql_upgrade did not create temporary files properly.
[17 Jun 2010 12:17] Bugs System
Pushed into 5.1.47-ndb-7.0.16 (revid:martin.skold@mysql.com-20100617114014-bva0dy24yyd67697) (version source revid:vasil.dimov@oracle.com-20100331130613-8ja7n0vh36a80457) (merge vers: 5.1.46) (pib:16)
[17 Jun 2010 13:04] Bugs System
Pushed into 5.1.47-ndb-6.2.19 (revid:martin.skold@mysql.com-20100617115448-idrbic6gbki37h1c) (version source revid:martin.skold@mysql.com-20100609211156-tsac5qhw951miwtt) (merge vers: 5.1.46-ndb-6.2.19) (pib:16)
[17 Jun 2010 13:44] Bugs System
Pushed into 5.1.47-ndb-6.3.35 (revid:martin.skold@mysql.com-20100617114611-61aqbb52j752y116) (version source revid:vasil.dimov@oracle.com-20100331130613-8ja7n0vh36a80457) (merge vers: 5.1.46) (pib:16)