Hi Techrunnr, this document deals with How to shrink ibdata1 file in /var/lib/mysql/.
By default ibdata1 file in /var/lib/mysql/ normally consists of 4 types of data
- Table Data
- Table Indexes
- MVCC (Multi versioning Concurrency Control) Data
- Table Metadata
Follow the below steps to shrink the ibdata1
- Take the dump of all the databases
- Stop mysql service
- Now we will remove the ibdata1, ib_logfile0, ib_logfile1
- Add the below content to the my.cnf file
- Start the mysql service
- ibdata1 contains table information, so we have deleted this file, so databases will be exist, but table information won’t be exit, when you try to get any table info from any database it will throw an error table doesn’t exists, or data engine is not exist, so we have taken the backup already, we will restore this backup. After starting the mysql service ibdata1, ib_logfile0 and ib_logfile1 will be created. ib_logfile0 and ib_logfile1 files will be created with the nearly 1GB each, ibdata1 will be created with size nearly 10MB
© 2019, Techrunnr. All rights reserved.