MySQL 如何在 XAMPP 中将默认存储引擎设置为 InnoDB
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2286813/
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
How to set the default storage engine to InnoDB in XAMPP
提问by Urvish
How do I set the default-storage-engine
to InnoDB in Linux XAMPP 1.7.3?
如何default-storage-engine
在 Linux XAMPP 1.7.3 中设置为 InnoDB?
回答by Hyman
The easiest way is just to go to the mysql config file (my.ini in windows, my.cnf in Linux) and just add this:
最简单的方法是转到 mysql 配置文件(Windows 中的 my.ini,Linux 中的 my.cnf)并添加以下内容:
[mysqld]
default-storage-engine=InnoDB
This assumes that you have enabled InnoDB
, which is another topic, but there are plenty of answerson how to do this. You can always check the default storage engine in phpMyAdmin on XAMPP: Just click on the server, then on engines, then on a particular engine (like MyISAM), and then see if it says MyISAM is the default storage engine on this MySQL server
.
这假设您已启用InnoDB
,这是另一个主题,但有很多关于如何执行此操作的答案。您始终可以在 XAMPP 上的 phpMyAdmin 中检查默认存储引擎:只需单击服务器,然后单击引擎,然后单击特定引擎(如 MyISAM),然后查看它是否显示MyISAM is the default storage engine on this MySQL server
。
回答by Erik Giberti
You set the default storage engine in the MySQL configuration, but that will only apply to tables that are created after that point. You'll need to alter any tables that aren't InnoDB manually like this. If you have lots of data, this can take a while because it will create the new table, insert all the records and then drop the old table leaving this one in it's place.
您在 MySQL 配置中设置了默认存储引擎,但这仅适用于在那之后创建的表。您需要像这样手动更改不是 InnoDB 的任何表。如果您有大量数据,这可能需要一段时间,因为它会创建新表,插入所有记录,然后删除旧表,将这个表留在原处。
ALTER TABLE table_name ENGINE = INNODB;
回答by seron
In case you use phpMyAdmin and have ALL PRIVILEGES
it can be set to set to InnoDB
under the menu Variables > default storage engine.
如果您使用 phpMyAdmin 并且ALL PRIVILEGES
可以将其设置为InnoDB
在菜单Variables > default storage engine 下设置。