InnoDB stores data in a tablespace. By default, there is one single tablespace and data of all the databases is stored in one file. This file has data dictionary, tables, as well as indexes in it. There is a global parameter innodb_data_file_path
that defines this tablespace file. It has a syntax like ibdata1:256M:autoextend
, this means at the beginning a file of size 256 MB will be created and then whenever the data size exceeds this, the file will be auto-extended. The innodb_autoextend_increment
variable defines in MB's that by how much each increment should be.
How you will get your Index Space?
You should first backup all InnoDB tables and change setting in my.ini/my.cnf
as innodb_file_per_table
and restart MySQL server.
Now import those tables now each table will have it's own tablespace which can shrink size on deleting a table.
These are possible workarounds:
- Separate Files per Table: InnoDB provides this option where data (data + indexes) for each table can be stored in a separate file through a global variable innodb_file_per_table.
- Fixed Tablespace size: One way to work around with the tablespace file size problems is to fix the tablespace size (remove autoextend) to an extrapolated value. So, when you hit the limit, you know it is time to cleanup.
- Move to MyISAM: For all the tables (or even databases), for which you feel data is not that critical to have transactions et al, move them to MyISAM.