diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc
index 1a870ce3abf24a1dbdb20c88981a751850b7889d..81a803e36b9e65687e98e33828c605676efa6a9e 100644
--- a/sql/ha_innodb.cc
+++ b/sql/ha_innodb.cc
@@ -424,7 +424,7 @@ innobase_mysql_tmpfile(void)
 {
 	char	filename[FN_REFLEN];
 	int	fd2 = -1;
-	File	fd = create_temp_file(filename, NullS, "ib",
+	File	fd = create_temp_file(filename, mysql_tmpdir, "ib",
 #ifdef __WIN__
 				O_BINARY | O_TRUNC | O_SEQUENTIAL |
 				O_TEMPORARY | O_SHORT_LIVED |