+-------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
如下命令:
1
2
3
mysql> alter table wholesale engine=innodb;
Query OK, 1 row affected (0.32 sec)
Records: 1 Duplicates: 0 Warnings: 0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
mysql> show create table wholesale;
+-------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table |
+-------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| jindong_wholesale | CREATE TABLE `wholesale` (
`act_id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
`goods_id` mediumint(8) unsigned NOT NULL,
`goods_name` varchar(255) NOT NULL,
`rank_ids` varchar(255) NOT NULL,
`prices` text NOT NULL,
`enabled` tinyint(3) unsigned NOT NULL,
PRIMARY KEY (`act_id`),
KEY `goods_id` (`goods_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 |
+-------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
多表改变引擎:
1
2
3
# mysqldump -uroot -p123456 sx >sx_bak.sql
sed -i "s/MyISAM/InnoDB/g" sx_bak.sql
mysql -uroot -p123456 sx <sx_bak.sql
首先我目前平台上承载的大部分项目是读多写少的项目,而MyISAM的读性能是比Innodb强不少的。