MySQL InnoDB, one file problem

I installed new server about 6 months ago and now found problem with MySQL InnoDB. I add and delete a few big InnoDB tables, but space of InnoDB still grow. I found a lot ideas how to fix it (dump all DB and restore back), but the best way is to add to MySQL config file “innodb_file_per_table”.

TODO:

  • Stop the MySQL server (usually “/etc/init.d/mysql stop” on Linux).
  • Edit the my.cnf file (located at somewhere like /etc/my.cnf or /etc/mysql/my.cnf)
  • Add “innodb_file_per_table” on a single line by itself into the my.cnf file.
  • Start the MySQLserver (“/etc/init.d/mysql start”).

Any new InnoDB tables that are created will now be created in the database’s directory with a single file per database table. Doing this does not affect any existing InnoDB tables they will still use the common data file.

Leave a Reply