我在我的「database_name」中創建了一個表license_serial。但是當我嘗試創建名爲license的第二個表時,它說它已經存在。
這是爲什麼?我的數據庫只包含一個license_serial.frm和一個db.opt。在MySQL中創建表
mysql> SHOW TABLES;
+---------------------+
| Tables_in_mobilemp3 |
+---------------------+
| license_serial |
+---------------------+
1 row in set (0.00 sec)
mysql> select * from license;
ERROR 1146 (42S02): Table 'mobilemp3.license' doesn't exist
創建第二表:
CREATE TABLE `license` (
`id` int(10) unsigned NOT NULL auto_increment,
`serial_id` int(10) unsigned NOT NULL,
`uid` bigint(20) unsigned NOT NULL,
`active` tinyint(1) NOT NULL,
`first_seen` timestamp NOT NULL default CURRENT_TIMESTAMP,
`last_seen` timestamp NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `serial_uid` (`serial_id`,`uid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
提供了以下錯誤消息:
ERROR 1050 (42S01): Table 'mobilemp3.license' already exists
編輯:
並將該溶液是這樣(在該順序):
drop database databasename;
create database databasename;
use databasename;
向我們展示命令的輸出SHOW TABLES – babonk
我讀這篇文章http://stackoverflow.com/questions/3302476/mysql-1050-error-table-already-exists-when-in-fact-it-does不,但我沒有得到解決方案,我刪除了什麼文件? – Kobe
向我們展示如何「創建第二個表」 –