Two steps to make your table compressed.
- Set the server INNODB_FILE_FORMAT to Barracuda.
- Alter table to compressed with 8KB key block size.
mysql> SET GLOBAL INNODB_FILE_FORMAT=Barracuda;
mysql> ALTER TABLE `compressed table` ROW_FORMAT=COMPRESSED, KEY_BLOCK_SIZE=8;
Actually, if your key block is 8KB, the default format is compressed for this size, you don't have to set ROW_FORMAT literally. So we can also use the following short statement to make it compressed.
mysql> ALTER TABLE `compressed table` KEY_BLOCK_SIZE=8;
As you can see, I used pairs of backquote (`) to escape any possible special characters in table name in order to keep the statement safe.