2016-05-16 62 views
0

MySQL 5.5.46異常なエラー:テーブルが存在せず、テーブルを作成できません。MySQL - テーブルが存在せず、作成できません

どうかお手伝いできますか?

drop table t_example; 

戻り値:ドロップテーブルt_exampleエラーコード:1051不明なテーブル 't_example' 0.000秒

CREATE TABLE t_example(
    `id_example` INT UNSIGNED NOT NULL AUTO_INCREMENT, 
    `des_example` VARCHAR(45) NOT NULL, 
    `id_example` int unsigned NULL, 
    PRIMARY KEY (`id_example`)) 
ENGINE = InnoDB 
DEFAULT CHARACTER SET = utf8 
COLLATE = utf8_general_ci; 

戻り値:エラーコードは:1050テーブル 't_example' はすでに

select * from t_example; 
が存在します

戻り値:エラーコード:1146.テーブル 't_example'は存在しません

私は使用しています:

  • UBUNTU 14.04 LTS;
  • mysqlの私は、rootユーザーを使用していますreadlineの6
  • を使用して、Debian-のlinux-gnuのための14.14按分5.5.46、(x86_64版)版試してみました

mysql> REPAIR TABLE t_example; 
+----------------+--------+----------+--------------------------------------+ 
| Table   | Op  | Msg_type | Msg_text        |    
+ ---------------+--------+----------+--------------------------------------+ 
| mydb.t_example | repair | Error | Table 'mydb.t_example' doesn't exist | 
| mydb.t_example | repair | status | Operation failed      |    
+----------------+--------+----------+--------------------------------------+ 
2 rows in set (0.00 sec) 

があまりにもしようとしました:sudo mysqladmin flush-tablesを...また、問題を解決していません!

REAL例:MySQLのINFORMATION_SCHEMAから

mysql> use flexible; 
Database changed 
mysql> select * from st_fin_centro_custo; 
ERROR 1146 (42S02): Table 'flexible.st_fin_centro_custo' doesn't exist 
mysql> CREATE TABLE st_fin_centro_custo(
    -> `cod_centro_custo` INT UNSIGNED NOT NULL AUTO_INCREMENT, 
    -> `des_centro_custo` VARCHAR(45) NOT NULL, 
    -> PRIMARY KEY (`cod_centro_custo`)) 
    -> ENGINE = InnoDB 
    -> DEFAULT CHARACTER SET = utf8 
    -> COLLATE = utf8_general_ci; 
ERROR 1050 (42S01): Table '`flexible`.`st_fin_centro_custo`' already exists 
mysql> drop table st_fin_centro_custo; 
ERROR 1051 (42S02): Unknown table 'st_fin_centro_custo' 
mysql> 

しようとしましたGET:

mysql> SELECT TABLE_CATALOG, TABLE_SCHEMA, TABLE_TYPE 
FROM information_schema.tables 
where table_name like 'st_fin_centro_custo'; 
    Empty set (0.00 sec) 

    mysql> 

注:別の名前でテーブルを作成するには、正常に動作します。

ありがとうございます!

+0

言及していない「USE」文はありますか? –

+1

コマンド 'show tables;'を発行してください。 – kkomash

+0

テーブルは 'show tables;'と表示されません。 –

答えて

0

テーブルが破損している可能性があります。

は、すべてのREPAIR TABLE t_example;

+0

anwerのためのThans:それは私のために働いていない! –

1
First select your data base schema by using use command<use schema>. 
Then run DROP TABLE IF EXISTS t_example; 
After that try to create your table 

CREATE TABLE t_example(
    `id_example` INT UNSIGNED NOT NULL AUTO_INCREMENT, 
    `des_example` VARCHAR(45) NOT NULL, 
    PRIMARY KEY (`id_example`)) 
ENGINE = INNODB 
DEFAULT CHARACTER SET = UTF8 
COLLATE = UTF8_GENERAL_CI; 

Also don't use duplicate column name. 

Another solution is : 

Change table name in the create table query, execute it and then rename the table. 

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

anwerのためのThans:それは私のために働いていない! –

+0

あなたは私にエラーを教えてもらえますか?私はちょうどこれを実行していると働いているので –

+0

上記の "実際の例"を読んでください。 –

0

まず試してみてください、mysqldを再起動してみてください。それが助けにならない場合は、このテーブルを別のデータベースに作成してみてください。新しく作成した*.frmファイルをターゲットデータベースフォルダにコピーします。もう一度mysqldを再起動してください。今、適切なDBにこのテーブルをアクセス/ドロップ/作成しようとします。

編集:データベースを削除してゼロから再作成するのはどうですか?私はそれが生産システムではないことを願っています。

+0

アンワーのおかげで:それは私のために働いていない! –

+0

これでテーブルは "show tables;"と表示されますが、SELECTを実行するとエラーが発生します:mysql> select * from st_fin_centro_custo; エラー1146(42S02):テーブル 'flexible.st_fin_centro_custo'が存在しません –

関連する問題