PHP/MariaDB/MySQL

Clean - Shrink ibdata1

Updated November 2026 12,165 views 3 min read
PHP/MySQL | Updated November 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

Frequently Asked Questions

What is the ibdata1 file?

ibdata1 is the InnoDB system tablespace for MariaDB/MySQL, where InnoDB stores data and metadata. It only grows and never shrinks on its own, so it can look large over time. On shared hosting you cannot shrink it directly because that needs server-level access.

Can I shrink ibdata1 on shared hosting?

Not directly, since it requires stopping the database and server-level access you do not have on a shared account. What you can do is reduce database bloat: optimize tables, remove unused data, and drop old databases, which limits further ibdata1 growth.

How do I reduce database bloat on shared hosting?

Optimize your tables in phpMyAdmin, delete unneeded rows and old logs, remove databases you no longer use, and keep applications tidy (for example clearing spam and post revisions in WordPress). This keeps InnoDB from expanding ibdata1 unnecessarily.

How do I actually shrink ibdata1 on a VPS or dedicated server?

With root access you can shrink it by enabling innodb_file_per_table, dumping all databases, stopping MySQL, deleting the ibdata1 and ib_logfile files, and reimporting so each table gets its own file. This is a server-level operation, so back up everything first.

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 November 2026 · Browse all PHP/MySQL articles

Share: X in Reddit f Email
  • 134 Users Found This Useful

Was this answer helpful?

Related Articles

Server Paths - PHP Perl Python and More

PHP/MariaDB/MySQL | Updated November 2026 The default path to PHP on Ultra Web Hosting...

phpMyAdmin - Error Incorrect format parameter

PHP/MariaDB/MySQL | Updated March 2026 The "Incorrect format parameter" error in phpMyAdmin...

Register Globals On Off

PHP/MySQL | Updated November 2026 register_globals was a PHP setting that automatically...

Changing Maximum Upload Size

PHP/MySQL | Updated November 2026 If you are getting errors like "The uploaded file exceeds...

Useful CSV to MySQL Script

PHP/MySQL | Updated January 2026 Importing CSV data into a MySQL/MariaDB database is a common...



Save 30% on web hosting - Use coupon code Hosting30