Reclaim disk space

from the Artful MySQL Tips List

The InnoDB tablespace files (ibdata*) are designed to reuse space, so there's not a simple way to reclaim space--you can't just remove a data file from system tablespace. To shrink tablespace file size ...

1. Dump all InnoDB tables with mysqldump.

2. Stop MySQL server.

3. Move all existing tablespace files (ibdata*, iblog*), and all .frm files for InnoDB tables, from the data folder to a safe place.

4. Configure a new tablespace.

5. Restart MySQL server.

6. Import the dump files.

Last updated 16 Aug 2019

Return to the Artful MySQL Tips page