c3cris c3cris - 2 months ago 22
MySQL Question

Error creating temp table

I am attempting to create a temp table

CREATE TEMPORARY TABLE `test_table` (
`test` DATE NOT NULL
);


Even if i try other schemas i get the following error

Can't create table 'db.test_table' (errno: -1)


I tried to google -1 error with no luck.

Answer

When creating a temporary table mysql requires an Engine and does not default to server settings.

http://dev.mysql.com/doc/refman/5.7/en/create-table.html

CREATE TEMPORARY TABLE `test_table` 
( test DATE NOT NULL ) 
ENGINE=MyISAM
Comments