Bug? #1146 - Table 'xxx.xxxxx' doesn't

2019-01-06 15:13发布

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?

18条回答
叼着烟拽天下
2楼-- · 2019-01-06 15:59

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

查看更多
Animai°情兽
3楼-- · 2019-01-06 15:59

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.

查看更多
男人必须洒脱
4楼-- · 2019-01-06 16:00

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.

查看更多
冷血范
5楼-- · 2019-01-06 16:02

As pprakash mentions above, copying the table.frm files AND the ibdata1 file was what worked for me. (I would have just commented on that comment but this SO requirement for 50 points means I have to provide a solution, even if it's just a rehash of an existing one ... weird.)

In short:

  1. Shut your DB explorer client emphasized text(eg 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 (eg MySQL Server/data/{yourschema}).
  5. Save a copy of the ibdata1 file to the data folder (ie, 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!)

查看更多
Deceive 欺骗
6楼-- · 2019-01-06 16:06

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...

查看更多
做自己的国王
7楼-- · 2019-01-06 16:07

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.

查看更多
登录 后发表回答