Home » Mysql » Table doesn't exist after CREATE TABLE

Table doesn't exist after CREATE TABLE

Posted by: admin November 29, 2017 Leave a comment

Questions:

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.

Answers:

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.

Questions:
Answers:

What worked for me was:

  • Going to the folder xampp/mysql/data/database-name/
  • You’ll see only the .frm file. The files .MYD and .MYI are missing for empty tables.
  • Delete the .frm file.
  • Stop MySQL process and restart it.
  • After that I was able to create the table.

The old version of xampp created tables in MyISAM format the new version as InnoDB!

Questions:
Answers:

I had this same problem. I got a “server went away” message when creating the table and after that I was getting table doesn’t exist messages, but I couldn’t try to re-create the table because then I got a message saying that it did exist. I solved it by executing this at the command line:

mysqlcheck --repair --all-databases -u root -p

It also wouldn’t hurt to restart the mysql server after this as well just in case.

Questions:
Answers:

Hmm, are you sure you have a database and are priviledged to do CREATE statements.

If you have phpmyadmin:

To test the first possibiblity, create a new (empty) test database, click it in the menu and
then press the SQL button in the top navigation and copy paste your statement again. If this doesn’t work try the second.

For the second you can click on the ‘home’ button and then go to ‘Privileges’. If there are only two or three accounts, but all with root privileges, you have the privileges to do a CREATE. Otherwise you can check your account and give yourself the privileges.

If both possibilities didn’t work-out I don’t know either. It worked fine for me 🙁

Questions:
Answers:

I had the same issue: #1146 – Table ‘tutsplus_ci.posts’ doesn’t exist. I solved this issue following these steps:

I made an export of the incriminated table in a sql file. I noticed that the table name in the .sql file has a suplemental trailing space.
I switch back to phpmyadmin in Operations section of my table and I rename the table from ‘ posts’ to ‘posts’. After taken all these actions the error didn’t show up.

To conclude, indeed the table ‘posts’ didn’t exist as error message said. Because the the actual name of the table was ‘ posts’ not ‘posts’. The space before the name is hard to be notice in phpmyadmin. This is the story. Nothing special.
I hope it helps!