php MySql - 将 InnoDB 转换为数据库的 MyISAM 存储引擎
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10280754/
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
MySql - Convert InnoDB to MyISAM Storage Engine of Database
提问by Tony Stark
How to convert database storage engine from InnoDBto MyISAMon MySQL?
I found so many sites which convert the storage engine of database table, but not for database.

如何将数据库存储引擎从 转换InnoDB为MyISAMon MySQL?我发现很多站点都转换了数据库表的存储引擎,但没有转换为数据库。

Thanks in advance.
提前致谢。
采纳答案by Eric Petroelje
You can't change the default storage engine for a database, but you can change it for the whole server using the default-storage-engineconfig setting. Note that this will not actually change the storage engine for existing tables though, just for new ones created after the change.
您无法更改数据库的默认存储引擎,但可以使用default-storage-engine配置设置为整个服务器更改它。请注意,这实际上不会更改现有表的存储引擎,只会更改更改后创建的新表。
回答by Developer
use this!!
用这个!!
SET storage_engine=MYISAM;
ALTER TABLE table_name ENGINE = MyISAM;
-cheers!!
-干杯!!
回答by Avinash Saini
ALTER TABLE `table_name` ENGINE=INNODB
回答by Ian
Databases are just MySQL's way of doing namespaces, as such the database has no engine associated to it, only the tables have a storage engine. Which is why you can have a database with several different tables each having a different engine.
数据库只是 MySQL 处理命名空间的方式,因此数据库没有与之关联的引擎,只有表才有存储引擎。这就是为什么您可以拥有一个包含多个不同表的数据库,每个表都有不同的引擎。
You will have to modify each table one by one to switch them to InnoDB.
您必须一一修改每个表才能将它们切换到 InnoDB。
回答by Dany Boivin
to make it permanent, add to my.cnf (few locations depending on context)
要使其永久化,请添加到 my.cnf(少数位置取决于上下文)
/etc/my.cnf
/etc/my.cnf
default-storage-engine= MyISAM
default-storage-engine= MyISAM
for safety, output the db list with show databases;
为安全起见,使用 show databases 输出数据库列表;
in my case, using php for quickie..
在我的情况下,使用 php 快速...
$db = mysql_connect('localhost','someadmin','somepass');
$dbs = array();
$dbs[] = 'test';
$dbs[] = 'myImportantDb';
foreach($dbs as $v){
mysql_select_db($v);
$q = mysql_query('show tables');
$tables = array();
while($r = mysql_fetch_row($q)){
$tables[] = $r[0];
}
foreach($tables as $t){
echo "do $v.$t\n";
mysql_query('ALTER TABLE `'.$t.'` ENGINE=MyISAM;');
}
}
mysql_close($db);
回答by Benson K B
In PhpMyadmin 4.5 Select the variable tab and find for storage engineand Select Edit and type MyISAM.
在 PhpMyadmin 4.5 中选择变量选项卡并找到 存储引擎并选择编辑并键入 MyISAM。
回答by Jhonattan Peláez
You can change the storage engine through PhpMyAdmin. In the details view of the table. See the screenshot:
您可以通过 PhpMyAdmin 更改存储引擎。在表的详细信息视图中。看截图:

