MYSQL查看及修改表使用的存储引擎_MySQL
程序员文章站
2022-04-19 07:58:03
...
bitsCN.com
MYSQL查看及修改表使用的存储引擎 正确的方法: show table status from db_name where name='table_name'; +------+--------+---------+------------+------+----------------+-------------+-----------------+| Name | Engine | Version | Row_format | Rows | Avg_row_length | Data_length | +---------+------------+------+----------------+-------------+-----------------+--------------+ | t | InnoDB | 10 | Compact | 3 | 5461 | 16384 | 0 | +------+--------+---------+------------+------+----------------+-------------+-----------------+ 不正确的方法: show create table table_name; +-------+-----------------------------------------------------------------------------------------+| Table | Create Table |+-------+-----------------------------------------------------------------------------------------+| t | CREATE TABLE `t` ( `vc` varchar(1) DEFAULT NULL, `c` char(1) DEFAULT NULL, KEY `c` (`c`)) ENGINE=InnoDB DEFAULT CHARSET=utf8 |+-------+------------------------------------------------------------------------------------------+ 如果mysqld没有启动对应的引擎如这里InnoDB,那么会使用默认的MYISAM引擎,所以不准确。 修改: alter table table_name engine=innodb; alter table table_name engine=myisam; bitsCN.com
MYSQL查看及修改表使用的存储引擎 正确的方法: show table status from db_name where name='table_name'; +------+--------+---------+------------+------+----------------+-------------+-----------------+| Name | Engine | Version | Row_format | Rows | Avg_row_length | Data_length | +---------+------------+------+----------------+-------------+-----------------+--------------+ | t | InnoDB | 10 | Compact | 3 | 5461 | 16384 | 0 | +------+--------+---------+------------+------+----------------+-------------+-----------------+ 不正确的方法: show create table table_name; +-------+-----------------------------------------------------------------------------------------+| Table | Create Table |+-------+-----------------------------------------------------------------------------------------+| t | CREATE TABLE `t` ( `vc` varchar(1) DEFAULT NULL, `c` char(1) DEFAULT NULL, KEY `c` (`c`)) ENGINE=InnoDB DEFAULT CHARSET=utf8 |+-------+------------------------------------------------------------------------------------------+ 如果mysqld没有启动对应的引擎如这里InnoDB,那么会使用默认的MYISAM引擎,所以不准确。 修改: alter table table_name engine=innodb; alter table table_name engine=myisam; bitsCN.com
上一篇: Visual Leak Detector (VLD)使用
下一篇: python ORM