Table doesn't exist after CREATE TABLE

前端 未结 6 553
栀梦
栀梦 2021-01-17 08:21

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)          


        
相关标签:
6条回答
  • 2021-01-17 08:57

    Go to the database in phpadmin and in sql drop the table .Then create the table.

    0 讨论(0)
  • 2021-01-17 09:06

    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!

    0 讨论(0)
  • 2021-01-17 09:08

    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.

    0 讨论(0)
  • 2021-01-17 09:11

    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!

    0 讨论(0)
  • 2021-01-17 09:13

    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.

    0 讨论(0)
  • 2021-01-17 09:14

    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 :(

    0 讨论(0)
提交回复
热议问题