Table doesn't exist after CREATE TABLE

Julien G picture Julien G · Nov 15, 2011 · Viewed 41.6k times · Source

I'm trying to import this sql in my database name symfony

CREATE TABLE IF NOT EXISTS ingredient (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1;

and i get

#1146 - Table 'symfony.ingredient' doesn't exist

This seems rather odd since i'm trying here to CREATE this table, so... why is it not working ? I've got the same problem if i try

CREATE TABLE symfony.ingredient

Or the feature in symfony 2

c:\Dev\Symfony>php app/console doctrine:schema:create

PS: I have this problem only with the new version of xampp.

EDIT

Well, i somehow managed to solve my problem. I dropped my database, then created one (not with the interface) and finally i restarded mysql service. I don't know why and how it unstuck me, but i hope this will help someone.

Answer

Lexxtor picture Lexxtor · Jun 7, 2012

I had the same problem. My solution: Change table name in the create table query, exequte it and then rename the table.

Then, you can also drop this table and after it create it without getting error.