MySQL CREATE TEMPORARY TABLE Error

不打扰是莪最后的温柔 提交于 2020-01-15 05:02:05

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!