简体   繁体   中英

InnoDB tables being made as MyISAM

I locally create my db tables using phpmyadmin. I set their engine to innoDB and create the foreign key relationships also using 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.

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:

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

From what you are saying, it looks like the production database server is ignoring the ENGINE=InnoDB clauses there.

Did you check to make sure that InnoDB is enabled on the production server?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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