[mysql] Bug? #1146 - Table 'xxx.xxxxx' doesn't exist

I am using windows XP. I am creating a table in phpMyAdmin using its built-in create table feature, my database name is ddd.

It generates the following code:

CREATE TABLE  `ddd`.`mwrevision` (

`asd` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`sddd` INT NOT NULL
) ENGINE = INNODB;

and the following error shows up:

MySQL said:     
#1146 - Table 'ddd.mwrevision' doesn't exist 

What might be the problem?

This question is related to mysql phpmyadmin mysql-error-1146

The answer is


if you are modifying mysql bin->data dir's and after that, your database import will not works

so you need to close wamp and after that start wamp

now database import will work fine


Check filenames.
You might need to create a new database in phpmyadmin that matches the database you're trying to import.


As pprakash mentions above, copying the table.frm files AND the ibdata1 file was what worked for me.

In short:

  1. Shut your DB explorer client (e.g. Workbench).
  2. Stop the MySQL service (Windows host).
  3. Make a safe copy of virtually everything!
  4. Save a copy of the table file(s) (eg mytable.frm) to the schema data folder (e.g. MySQL Server/data/{yourschema}).
  5. Save a copy of the ibdata1 file to the data folder (i.e., MySQL Server/data).
  6. Restart the MySQL service.
  7. Check that the tables are now accessible, queryable, etc. in your DB explorer client.

After that, all was well. (Don't forget to backup if you have success!)


Restarting MySQL works fine for me.


Today i was facing same problem. I was in very difficult situation but what id did i create a table with diffrent name e.g (modulemaster was not creating then i create modulemaster1) and after creating table i just do the rename table.


run from CMD & %path%=set to mysql/bin

mysql_upgrade -u user -ppassword


I had the same problem and can't get a good tip for this over the web, so I shared this for you and for all who needs.

In my situation I copy a database (all files: frm, myd) to the data folder in MySQL data folder (using Wamp at home). All thing was OK until I want to create a table and have the error #1146 Table '...' doesn't exist!.

I use Wamp 2.1 with MySQL version 5.5.16.

My solution:

  1. Export the database to file;

  2. verify if exported file is really OK!!;

  3. drop the database where I have issues;

  4. create a new database with the same name that the last;

  5. import the file to the database.

FOR ME IS PROBLEM SOLVED. Now I can create tables again without errors.


Column names must be unique in the table. You cannot have two columns named asd in the same table.


In my case I ran this command even if the table wasn't visible in PhpMyAdmin :

DROP TABLE mytable

then

CREATE TABLE....

Worked for me !


I had the same problem. I tried to create a table in mysql and got the same error. I restarted mysql server and ran the command and was able to create/migrate table after restating.


In my case, MySQL's parameter; lower_case_table_names was configured = 0.

It causes queries related with using upper cases will not work.


The reason I was facing this was because I had two "models.py" files which contained slightly different fields. I resolved it by:

  1. deleting one of the models.py files
  2. correcting references to the deleted file
  3. then running manage.py syncdb

I had this problem because of a trigger not working..Worked after I deleted the trigger.


Recently I had same problem, but on Linux Server. Database was crashed, and I recovered it from backup, based on simply copying /var/lib/mysql/* (analog mysql DATA folder in wamp). After recovery I had to create new table and got mysql error #1146. I tried to restart mysql, and it said it could not start. I checked mysql logs, and found that mysql simply had no access rigths to its DB files. I checked owner info of /var/lib/mysql/*, and got 'myuser:myuser' (myuser is me). But it should be 'mysql:adm' (so is own developer machine), so I changed owner to 'mysql:adm'. And after this mysql started normally, and I could create tables, or do any other operations.

So after moving database files or restoring from backups check access rigths for mysql.

Hope this helps...


I got this issue after copying mytable.idb table file from another location. To fix this problem I did the following:

ALTER TABLE mydatabase.mytable DISCARD TABLESPACE;

Copy mytable.idb

ALTER TABLE mydatabase.mytable IMPORT TABLESPACE;

Restart MySql


For me it was a table name upper/lower case issue. I had to make sure that table case name matched in a delete query, table notifications was not the same as Notifications. I fixed it by matching table name case with query and what MySQLWorkbench reported.

What is wierd is that this error showed up in a worked sql statement. Don't know what caused this case sensitivity. Perhaps an auto AWS RDS update.


I encountered the same problem today. I was trying to create a table users, and was prompted that ERROR 1146 (42S02): Table users doesn't exist, which did not make any sense, because I was just trying to create the table!!

I then tried to drop the table by typing DROP TABLE users, knowing it would fail because it did not exist, and I got an error, saying Unknown table users. After getting this error, I tried to create the table again, and magically, it successfully created the table!

My intuition is that I probably created this table before and it was not completely cleared somehow. By explicitly saying DROP TABLE I managed to reset the internal state somehow? But that is just my guess.

In short, try DROP whatever table you are creating, and CREATE it again.


I had the same issue. It happened after windows start up error, it seems some files got corrupted due to this. I did import the DB again from the saved script and it works fine.


Examples related to mysql

Implement specialization in ER diagram How to post query parameters with Axios? PHP with MySQL 8.0+ error: The server requested authentication method unknown to the client Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver' phpMyAdmin - Error > Incorrect format parameter? Authentication plugin 'caching_sha2_password' is not supported How to resolve Unable to load authentication plugin 'caching_sha2_password' issue Connection Java-MySql : Public Key Retrieval is not allowed How to grant all privileges to root user in MySQL 8.0 MySQL 8.0 - Client does not support authentication protocol requested by server; consider upgrading MySQL client

Examples related to phpmyadmin

phpMyAdmin on MySQL 8.0 phpmyadmin - count(): Parameter must be an array or an object that implements Countable Error loading MySQLdb Module 'Did you install mysqlclient or MySQL-python?' phpMyAdmin ERROR: mysqli_real_connect(): (HY000/1045): Access denied for user 'pma'@'localhost' (using password: NO) phpMyAdmin access denied for user 'root'@'localhost' (using password: NO) mysqli_real_connect(): (HY000/2002): No such file or directory How to create a foreign key in phpmyadmin #1292 - Incorrect date value: '0000-00-00' MySQL error - #1932 - Table 'phpmyadmin.pma user config' doesn't exist in engine phpMyAdmin Error: The mbstring extension is missing. Please check your PHP configuration

Examples related to mysql-error-1146

Populating a database in a Laravel migration file Bug? #1146 - Table 'xxx.xxxxx' doesn't exist Mysql 1050 Error "Table already exists" when in fact, it does not