MySql -将InnoDB转换为MyISAM存储引擎的数据库。

时间:2022-09-24 11:18:03

How to convert database storage engine from InnoDB to MyISAM on MySQL? I found so many sites which convert the storage engine of database table, but not for database. MySql -将InnoDB转换为MyISAM存储引擎的数据库。

如何在MySQL上将数据库存储引擎从InnoDB转换为MyISAM ?我发现很多网站都在转换数据库表的存储引擎,而不是数据库。

Thanks in advance.

提前谢谢。

7 个解决方案

#1


11  

You can't change the default storage engine for a database, but you can change it for the whole server using the default-storage-engine config setting. Note that this will not actually change the storage engine for existing tables though, just for new ones created after the change.

您不能更改数据库的默认存储引擎,但是可以使用缺省存储引擎配置设置对整个服务器进行更改。请注意,这实际上不会更改现有表的存储引擎,只会更改更改后创建的新表。

#2


40  

use this!!

使用这个! !

SET storage_engine=MYISAM;
ALTER TABLE table_name ENGINE = MyISAM;

-cheers!!

干杯! !

#3


12  

ALTER TABLE `table_name` ENGINE=INNODB

#4


8  

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。

#5


3  

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 database的db列表;

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);

#6


1  

In PhpMyadmin 4.5 Select the variable tab and find for storage engine and Select Edit and type MyISAM.

在phpadmin my4.5中,选择variable选项卡并查找存储引擎,选择Edit和键入MyISAM。

#7


0  

You can change the storage engine through PhpMyAdmin. In the details view of the table. See the screenshot:

您可以通过PhpMyAdmin更改存储引擎。在表的细节视图中。看到截图:

Changing storage engine in PhpMyAdmin

在PhpMyAdmin中更改存储引擎

#1


11  

You can't change the default storage engine for a database, but you can change it for the whole server using the default-storage-engine config setting. Note that this will not actually change the storage engine for existing tables though, just for new ones created after the change.

您不能更改数据库的默认存储引擎,但是可以使用缺省存储引擎配置设置对整个服务器进行更改。请注意,这实际上不会更改现有表的存储引擎,只会更改更改后创建的新表。

#2


40  

use this!!

使用这个! !

SET storage_engine=MYISAM;
ALTER TABLE table_name ENGINE = MyISAM;

-cheers!!

干杯! !

#3


12  

ALTER TABLE `table_name` ENGINE=INNODB

#4


8  

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。

#5


3  

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 database的db列表;

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);

#6


1  

In PhpMyadmin 4.5 Select the variable tab and find for storage engine and Select Edit and type MyISAM.

在phpadmin my4.5中,选择variable选项卡并查找存储引擎,选择Edit和键入MyISAM。

#7


0  

You can change the storage engine through PhpMyAdmin. In the details view of the table. See the screenshot:

您可以通过PhpMyAdmin更改存储引擎。在表的细节视图中。看到截图:

Changing storage engine in PhpMyAdmin

在PhpMyAdmin中更改存储引擎