万答#19,MySQL可以禁用MyISAM引擎吗?

2022-10-23,,,

GreatSQL社区原创内容未经授权不得随意使用,转载请联系小编并注明来源。

MyISAM的适用场景越来越少了。

随着MySQL 8.0的推出,系统表已经全面采用InnoDB引擎,不再需要MyISAM引擎。另外,MGR中也不支持MyISAM引擎。

因此,基本上可以考虑全面禁止使用MyISAM引擎了,问题是,这可行吗?

答案是肯定的,可以做到。

从MySSQL 5.7.8开始,新增一个选项 disabled_storage_engines,只需要设置下即可:

disabled_storage_engines = MyISAM

这就完美地实现禁用MyISAM的目的了。

另外,这么设置的话,是不会影响MySQL实例初始化的。即便是在MySQL 5.7版本中,系统表要使用MyISAM引擎,也不会影响生成MyISAM引擎的系统表。

disabled_storage_engines is disabled and has no effect if the server is started with any of these options: --bootstrap, --initialize, --initialize-insecure, --skip-grant-tables.

不过,设置该选项后可能会影响 mysql_upgrade 升级:

Setting disabled_storage_engines might cause an issue with mysql_upgrade. For details, see Section 4.4.7, “mysql_upgrade — Check and Upgrade MySQL Tables”.

执行 mysql_upgrade 进行升级时可能会报错:

mysql_upgrade: [ERROR] 3161: Storage engine MyISAM is disabled
(Table creation is disallowed).

这时候需要临时关闭该选项,等待升级完成后再重新启用即可。

Enjoy GreatSQL

本文由博客一文多发平台 OpenWrite 发布!

万答#19,MySQL可以禁用MyISAM引擎吗?的相关教程结束。

《万答#19,MySQL可以禁用MyISAM引擎吗?.doc》

下载本文的Word格式文档,以方便收藏与打印。