我在我的“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
向我们展示如何“创建第二个表” –