问题
I'm running EasyPHP 5.4.6 with MySQL 5.5.27-log.
When I try to create a temporary table using the following:
CREATE TEMPORARY TABLE temp_table (x int);
I get the following error:
ERROR 1005 (HY000): Can't create table 'temp_table' (errno: 22)
However, it works if I remove the "TEMPORARY".
The syntax for the temporary table was copied verbatim from an example page. I tried googling the error numbers, but that yielded nothing I could use.
Can anyone think of what may be going on?
回答1:
errno: 22 indicates that MySQL is trying to access a file with an invalid path (fopen -> INVAL). MySQL is not likely to generate an invalid path, so check that your temp path is set correctly. If you have a custom set tmpdir in your MySQL configuration, make sure it's a valid path. If not, check the current value using SHOW VARIABLES LIKE '%tmp%'
; If something is incorrect or missing, check that your system's TEMP environment variable is set properly. For more info, check http://dev.mysql.com/doc/refman/5.5/en/temporary-files.html.
回答2:
Make sure the user you are using has the create_tmp_table_priv
privelege granted (table user
of the mysql
database)
来源:https://stackoverflow.com/questions/13635450/mysql-create-temporary-table-error