The ibdata1 file cannot be shrunk, which is a particularly troublesome feature of MySQL. You can shrink the ibdata1 file if you drop all databases, delete the files, and reload mysqldump.
We can configure MySQL so that each table (including its indexes) is stored as a separate file. Enabled by default starting with MySQL version 5.6.6.
To set up our server to use a separate file for each table, we need to change my.cnf to enable it.
If your MySQL version is lower than 5.6.6, then you need to add this to the my.cnf file.
[mysqld] innodb_file_per_table = 1
The above is the detailed content of How to shrink/clear ibdata1 file in MySQL?. For more information, please follow other related articles on the PHP Chinese website!