Clean - Shrink ibdata1

PHP/MySQL | Updated 2026

The ibdata1 file is the InnoDB system tablespace used by MariaDB/MySQL. On shared hosting, you cannot shrink this file directly since it requires server-level access. However, there are steps you can take to manage your database size and reduce unnecessary InnoDB bloat.

01. What Is ibdata1?

The ibdata1 file stores InnoDB table data, indexes, undo logs, and other internal structures. It grows as your databases grow, but by default it does not shrink when you delete data. This is a known characteristic of the InnoDB storage engine. Even after deleting tables or rows, the space inside ibdata1 is marked as reusable but the file itself does not get smaller on disk.

02. What You Can Do on Shared Hosting

Optimize your tables

In phpMyAdmin, select your database, check all tables, and choose "Optimize table" from the dropdown. This reclaims unused space within the tables themselves:

OPTIMIZE TABLE table_name;

Or optimize all tables at once:

mysqlcheck -u dbuser -p --optimize dbname

Clean up unnecessary data

  • WordPress - Delete post revisions, spam comments, transient options, and orphaned metadata. Plugins like WP-Optimize can automate this.
  • Clear application caches - Many CMS platforms store cache data in the database that can be safely purged.
  • Remove unused tables - Uninstalled plugins sometimes leave their tables behind. Drop them if you are certain the plugin is gone for good.

Contact support

If your database disk usage seems disproportionately large compared to the actual data, open a ticket. We can check the InnoDB configuration and help identify what is consuming space.

03. VPS/Dedicated: Shrinking ibdata1

If you manage your own VPS or dedicated server, shrinking ibdata1 requires exporting all databases, stopping MySQL, deleting the file, reconfiguring InnoDB to use file-per-table mode, restarting MySQL, and re-importing. This is a complex procedure:

  1. Enable innodb_file_per_table in my.cnf (stores each table in its own .ibd file instead of ibdata1)
  2. Export all databases with mysqldump
  3. Stop MySQL
  4. Delete ibdata1, ib_logfile0, ib_logfile1
  5. Start MySQL (it recreates a minimal ibdata1)
  6. Re-import all databases
VPS Users Only

This procedure involves stopping the database server and deleting data files. One mistake can result in total data loss. Always have verified backups before attempting this. If you are not confident with this process, contact us for assistance.

For database backup methods, see How to Backup a MySQL Database.

Database Taking Too Much Space?

If your database usage seems high, open a ticket and we will help identify what is consuming space and how to reduce it.

Open a Support Ticket

Quick Recap

  1. ibdata1 grows but does not shrink automatically - InnoDB design
  2. Shared hosting: optimize tables and clean up unnecessary data
  3. Use WP-Optimize for WordPress database cleanup
  4. VPS: full export/delete/reimport procedure required to shrink the file
  5. Enable innodb_file_per_table to prevent future bloat on VPS

Database management · Last updated March 2026 · Browse all PHP/MySQL articles

  • 134 Users Found This Useful

Was this answer helpful?

Related Articles

What Port is MariaDB/MySQL On?

PHP/MariaDB/MySQL | Updated 2026 MariaDB/MySQL runs on port 3306 by default on all Ultra Web...

PHP system exec Functions Disabled on Shared Hosting

PHP/MariaDB/MySQL | Updated March 2026 The error "Warning: system() has been disabled for...

How do I backup a MariaDB - MySQL Database?

PHP/MySQL | Updated 2026 Backing up your database is essential before making changes to your...

Running a PHP file with a cron job

PHP/MySQL | Updated 2026 You can schedule PHP scripts to run automatically at set intervals...

Learn About MySQL

Databases | Updated 2026 MariaDB (the MySQL-compatible database server on Ultra Web Hosting)...



Save 30% on web hosting - Use coupon code Hosting30