MySQL 如何使 innodb 成为默认引擎

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4199446/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 17:43:44  来源:igfitidea点击:

How to make innodb as default engine

mysqlinnodb

提问by user476554

I am trying to make Innodb as my default engine and I changed this in the my.cnf file.

我试图将 Innodb 作为我的默认引擎,并在 my.cnf 文件中更改了它。

I set default-storage-engine=InnoDB in my.cnf file and restarted mysql but still it's not taking it.

我在 my.cnf 文件中设置了 default-storage-engine=InnoDB 并重新启动了 mysql 但它仍然没有接受它。

Even after restarting the server, it's still showing default engine as MyISAM.

即使在重新启动服务器后,它仍将默认引擎显示为 MyISAM。

show engines

显示引擎

+------------+---------+-
| Engine | Support |
+------------+---------+-
| InnoDB | YES |
| MRG_MYISAM | YES |
| BLACKHOLE | YES |
| CSV | YES |
| MEMORY | YES |
| FEDERATED | NO |
| ARCHIVE | YES |
| MyISAM | DEFAULT|
+------------+---------+-

+------------+---------+-
| 发动机 | 支持 |
+------------+---------+-
| InnoDB | 是 |
| MRG_MYISAM | 是 |
| 黑洞 | 是 |
| CSV | 是 |
| 内存 | 是 |
| 联合 | 否 |
| 存档 | 是 |
| 我的ISAM | 默认|
+------------+---------+-

How can I change it to InnoDB ?

如何将其更改为 InnoDB ?

回答by Ike Walker

Make sure you add this line in the proper section of the my.cnf file. It needs to be in the [mysqld]section:

确保在 my.cnf 文件的适当部分添加此行。它需要在以下[mysqld]部分:

default-storage-engine=InnoDB

Also, comment out any other line in my.cnf that may be setting it to MyISAM.

此外,注释掉 my.cnf 中可能将其设置为 MyISAM 的任何其他行。