WordPress··5 min read

WordPress Database Too Large to Import? Here's What to Do

Migrating WordPress to new hosting but the database export is too big. Practical solutions that actually work.

Moving WordPress to a new host. The database export is 500MB. The new host's phpMyAdmin times out at 50MB. Classic.

Why WordPress databases get so big

A few common culprits:

  • Post revisions — WordPress keeps every saved version of every post
  • wp_options autoload — Plugins dump data here and never clean up
  • Spam comments — Even deleted ones can linger
  • Action Scheduler / WooCommerce logs — Transaction logs that grow forever
  • Big plugins — Some caching or SEO plugins store tons of data

Before you migrate: Clean up

If you still have access to the old site, run some cleanup first:

-- Delete post revisions (careful with this)
DELETE FROM wp_posts WHERE post_type = 'revision';

-- Delete trashed posts
DELETE FROM wp_posts WHERE post_status = 'trash';

-- Delete spam and trashed comments  
DELETE FROM wp_comments WHERE comment_approved = 'spam' OR comment_approved = 'trash';

-- Clean up orphaned postmeta
DELETE pm FROM wp_postmeta pm LEFT JOIN wp_posts p ON pm.post_id = p.ID WHERE p.ID IS NULL;

Or use a plugin like WP-Optimize to do this through the admin interface.

Option 1: Split the SQL file

Already have the export and can't access the old site? Split it into chunks.

  1. Split your SQL file into 10-20MB chunks
  2. Import the first chunk (this has table structures)
  3. Import remaining chunks in order

Split your WordPress database export

Break it into phpMyAdmin-friendly pieces.

Open SQLSplit

Option 2: Use a migration plugin

Plugins like All-in-One WP Migration or Duplicator handle large databases better because they:

  • Split exports automatically
  • Can exclude large tables (like post revisions)
  • Have their own import process that bypasses phpMyAdmin

The free versions have size limits though. All-in-One caps at 512MB unless you buy the extension.

Option 3: SSH import

If your new host has SSH:

# Upload the SQL file via SFTP first
mysql -u db_user -p database_name < wordpress_backup.sql

No size limits, no timeout issues.

Option 4: Ask your host

Seriously. Many hosts will import a large database for you if you ask support. They can do it directly on the server. Some even have special tools for WordPress migrations.

After import: Update URLs

Don't forget — if you're changing domains, you need to update URLs in the database. The old domain is hardcoded in wp_options, wp_posts, and wp_postmeta.

Use WP-CLI if available:

wp search-replace 'oldsite.com' 'newsite.com' --all-tables

Or a plugin like Better Search Replace.

Frequently Asked Questions

Why is my WordPress database so large?

Common causes: post revisions (WordPress saves every edit), spam comments, plugin data in wp_options, WooCommerce logs, and caching plugin data. A typical blog shouldn't exceed 100MB without something unusual.

Can I delete WordPress post revisions?

Yes. Post revisions are safe to delete — they're just old versions of your content. You can delete them via SQL, plugins like WP-Optimize, or add define('WP_POST_REVISIONS', 3) to wp-config.php to limit future revisions.

What's the easiest way to migrate a large WordPress site?

If you have SSH access on the new host, use command line mysql import — no size limits. Otherwise, split the SQL file into chunks or use a migration plugin that handles large databases.

Related articles

View all

Advertisement