How to shrink/ purge ibdata1 file in MySQL?

The ibdata1 file cannot shrink, it is a particularly troublesome feature of MySQL. The ibdata1 file can be shrinked if you delete all databases, remove the files and reload the mysqldump.

We can configure MySQL so that each table, including its indexes, is stored as a separate file. It is enabled by default as of version 5.6.6 of MySQL.

To setup our server to use separate files for each table, we need to change my.cnf in order to enable it.

My CNF Changing

If your MySQL version is below 5.6.6, then you need to add it in my.cnf file.

   innodb_file_per_table = 1

Updated on: 30-Jul-2019

2K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started