Reputation: 2082
I'm trying to import a SQL dump to another server. It fails on the first line. I'm first creating the exp_actions
table and then inserting a bunch of data into it, but I get this really weird error.
SQL query:
--
-- Database: `ee_cmssite`
--
-- --------------------------------------------------------
--
-- Table structure for table `exp_actions`
--
CREATE TABLE `exp_actions` (
`action_id` INT( 4 ) UNSIGNED NOT NULL AUTO_INCREMENT ,
`class` VARCHAR( 50 ) NOT NULL DEFAULT '',
`method` VARCHAR( 50 ) NOT NULL DEFAULT '',
PRIMARY KEY ( `action_id` )
) ENGINE = MYISAM DEFAULT CHARSET = latin1 AUTO_INCREMENT =21;
MySQL said:
#1146 - Table 'site_ee.exp_actions' doesn't exist
Why doesn't it exist? I just instructed it to be created. I'm completely baffled. I've tried with and without IF_NOT_EXISTS
Upvotes: 1
Views: 6838
Reputation: 36
If anyone else comes across this seemingly bizarre error - see https://stackoverflow.com/a/11696069 for the solution.
I had the same symptoms and the cause was the same - moving to a new machine I took the old short-cut of simply copying the databases from the mysql/data directory that I needed directly into the new machine, however some were newer InnoDb types. This causes the Create Table throws table doesn't exist error. I had to drop the database and recreate it, then import from an sql dump.
Upvotes: 2
Reputation: 5341
While the error is not clear, I think this is related to the missing USE
at the beginning of the file. mysqldump doesn't add a USE
statement when you dump a single db. So you should add:
USE `ee_cmssite`;
Upvotes: 0
Reputation: 2150
According to the SQL script, the table exists in another database:
--
-- Database:
ee_cmssite
-- --------------------------------------------------------
-- Table structure for table
exp_actions
try to use ee_cmssite
database instead.
Upvotes: 0