如问题标题中所示 - MySQL 数据库是否可能具有同名的重复表?是否有可用于数据库的指令以允许这样做?
通常,当尝试添加重复表时,MySQL 应该返回错误#1050 - Table 'tablename' already exists
,但是最近,在处理一个项目时,我注意到数据库中的几乎每个表都是重复的(只有结构,新表是空的)。虽然我知道可以执行一些表创建脚本,但 MySQL 不应该允许这样做,对吗?
甚至如何处理这样的问题?导致这种情况的程序是 Magento - 基于 PHP 的电子商务平台。
这个数据库有部分转储:
--
-- Table structure for table `adminnotification_inbox`
--
CREATE TABLE IF NOT EXISTS `adminnotification_inbox` (
`notification_id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Notification id',
`severity` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT 'Problem type',
`date_added` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'Create date',
`title` varchar(255) NOT NULL COMMENT 'Title',
`description` text COMMENT 'Description',
`url` varchar(255) DEFAULT NULL COMMENT 'Url',
`is_read` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT 'Flag if notification read',
`is_remove` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT 'Flag if notification might be removed',
PRIMARY KEY (`notification_id`),
KEY `IDX_ADMINNOTIFICATION_INBOX_SEVERITY` (`severity`),
KEY `IDX_ADMINNOTIFICATION_INBOX_IS_READ` (`is_read`),
KEY `IDX_ADMINNOTIFICATION_INBOX_IS_REMOVE` (`is_remove`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Adminnotification Inbox' AUTO_INCREMENT=26 ;
--
-- Dumping data for table `adminnotification_inbox`
--
-- there was some data from this table, not relevant here
-- --------------------------------------------------------
--
-- Table structure for table `
adminnotification_inbox`
--
-- in use(#1146 - Table 'dev_testproject_1_12.
adminnotification_inbox' doesn't exist)
-- in use (#1146 - Table 'dev_testproject_1_12.
adminnotification_inbox' doesn't exist)
-- --------------------------------------------------------
Run Code Online (Sandbox Code Playgroud)
我认为这个转储甚至不会在没有错误的情况下运行。