mysql 数据库空间瘦身

发表于

首先,ENGINE类型innodb比myisam占的空间大,如果只是想要mysql占的空间小,那么就采用myisam

1、找到InnoDB的表:show table status where Engine = 'InnoDB';

2、更改ENGINE类型为MyISAM的命令:ALTER TABLE table_name ENGINE=MyISAM;

3、用命令show table status where Data_free <>'0'; 查看,Data_free不为0的,就是有碎片空间的,可以优化。

4、用命令optimize table table_name,来优化,就能缩小空间了