0

I have a create table statement:

DROP TABLE IF EXISTS `example`;
CREATE TABLE `example` (
`date` datetime DEFAULT NULL,
`id` varchar(200) DEFAULT NULL,
....
`source` varchar(200) DEFAULT NULL,
KEY `idx1` (`source`),
KEY `idx2` (`id`,`date`) USING BTREE,
) ENGINE=MyISAM DEFAULT CHARSET=latin1

When executing the code above, it creates a table as expected but with a warning:

0 row(s) affected, 1 warning(s): 1266 Using storage engine InnoDB for table 'example'

Why I got this warning? How can I change the engine to MyISAM? I'm new to MySQL, please can someone give me some hint, thanks.

wawawa
  • 2,835
  • 6
  • 44
  • 105
  • First, please use InnoDB as it is the default and a much more superior engine than MyIsam. Second, you probably have the SQL mode set for no engine substitution set (see https://dev.mysql.com/doc/refman/8.0/en/sql-mode.html#sqlmode_no_engine_substitution) which keeps people from using less performant or unavailable storage engines. – Dave Stokes Jan 13 '21 at 15:40
  • https://dba.stackexchange.com/questions/24951/choosing-myisam-over-innodb-for-these-project-requirements-and-long-term-option/24968#24968 This post seems suggests for my case it's better to use MyISAM as I have lots of write but few read. – wawawa Jan 13 '21 at 15:51
  • 2
    MyISAM is in fact not faster than InnoDB except in some edge cases. But what's more important than marginal performance differences is **not corrupting your data.** Read my answer to [MyISAM versus InnoDB](https://stackoverflow.com/questions/20148/myisam-versus-innodb/17706717#17706717). – Bill Karwin Jan 13 '21 at 15:57

0 Answers0