简体   繁体   English

将InnoDB表制作为MyISAM

[英]InnoDB tables being made as MyISAM

I locally create my db tables using phpmyadmin. 我使用phpmyadmin在本地创建数据库表。 I set their engine to innoDB and create the foreign key relationships also using phpmyadmin. 我将它们的引擎设置为innoDB,并且也使用phpmyadmin创建了外键关系。 It all works locally. 所有这些都在本地工作。

However if I try to export those tables to the production site, the tables are created as MYISAM, and through the indexes on columns are created, they aren't linked as foreign keys to another table. 但是,如果我尝试将这些表导出到生产站点,则表将创建为MYISAM,并且通过创建列上的索引,它们不会作为外键链接到另一个表。

Any ideas why this would happen? 任何想法为什么会发生这种情况?

To export the tables, I just go to Export in PhpMyAdmin, this is an example of the query it gives me which I run on the production site: 要导出表,我只是转到PhpMyAdmin中的Export,这是查询的一个示例,它为我提供了在生产站点上运行的查询:

CREATE TABLE IF NOT EXISTS `foo` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `barId` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `barId` (`barId`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;


ALTER TABLE `foo`
  ADD CONSTRAINT `foo_ibfk_1` FOREIGN KEY (`barId`) REFERENCES `barTable` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION;

This does create the table and makes an index on barId, but the table engine is myisam instead of inno, and there's no foreign key on barId refering to barTable.id 这确实会创建表并在barId上建立索引,但是表引擎是myisam而不是inno,并且barId上没有指向barTable.id的外键

From what you are saying, it looks like the production database server is ignoring the ENGINE=InnoDB clauses there. 用您的话来说,生产数据库服务器似乎忽略了ENGINE = InnoDB子句。

Did you check to make sure that InnoDB is enabled on the production server? 您是否检查以确保在生产服务器上启用了InnoDB?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM