phpMyAdmin Export to CSV Missing Rows – Fix It

When you export a table to CSV in phpMyAdmin, some rows just vanish. It's a memory limit issue, not data corruption. Here's the real fix.

When This Happens

You're in phpMyAdmin (say version 5.2.1 on a shared host or local XAMPP). You export a table with 10,000 rows to CSV. You open the file in Excel or Notepad and only see 5,000 rows. The rest are gone. No error message, no warning. Just missing data.

I saw this last month with a client's inventory table. 12,000 products exported to CSV, only 6,800 showed up. They thought the database was corrupted. It wasn't. The fix took 30 seconds.

Root Cause

It's not a bug in phpMyAdmin’s export logic. It's a PHP memory limit. When you export a large dataset, phpMyAdmin has to hold all those rows in memory before writing them to the CSV file. If PHP's memory limit is too low (common default: 128MB or 256MB), PHP stops processing mid-export. It doesn't throw an error — it just silently stops fetching rows.

Think of it like a bucket that can only hold 5 gallons. If you try to pour 10 gallons in, the bucket overflows and you lose half the water. The export script doesn't tell you it overflowed. It just gives you what fit.

The Fix

You have two ways to fix this. The first is quick and works for most people. The second is more permanent.

Option 1: Change Memory Limit in phpMyAdmin Config

  1. Open the file /path/to/phpmyadmin/libraries/config.default.php. On XAMPP, it's usually in C:\xampp\phpMyAdmin\libraries\config.default.php.
  2. Search for this line:
    $cfg['MemoryLimit'] = '-1';
    If it's set to -1, that means no limit. But on many setups, it's set to '256M' or '128M'. Change it to -1 or a higher value like '512M'. I recommend '512M' unless your server has less than 1GB RAM.
  3. Save the file.
  4. Restart your web server (Apache, Nginx, etc.). On XAMPP, stop and start Apache from the control panel.

Option 2: Override in config.inc.php (if option 1 doesn't work)

  1. Open /path/to/phpmyadmin/config.inc.php. If it doesn't exist, copy config.sample.inc.php to config.inc.php.
  2. Add this line near the top:
    $cfg['MemoryLimit'] = '512M';
  3. Save and restart Apache.

What to Check If It Still Fails

If the rows are still missing after this, check these three things:

  • PHP.ini memory limit — open php.ini and look for memory_limit. Set it to at least 512M. On shared hosts, you might need to ask support or use a .user.ini file.
  • Max execution time — export can be slow for big tables. Set max_execution_time to 0 (no limit) in php.ini or add $cfg['ExecTimeLimit'] = 0; to config.inc.php.
  • Use a different export method — instead of the web interface, use the MySQL command line:
    mysql -u username -p database_name -e "SELECT * FROM table_name" > output.csv
    This bypasses PHP entirely and never hits memory limits.

Also, check if you're using an old phpMyAdmin version. Versions before 5.0 had a known bug where export would silently truncate rows if the CSV included special characters. Upgrade to 5.2.2 or later. But in my experience, 9 times out of 10, it's the memory limit.

Quick tip: If you're on a shared host that won't let you change PHP memory, ask them to set it higher or export via MySQL command line. Most hosts will do it in 5 minutes.
Related Errors in Database Errors
0X00001AC0 Fixing 0x1AC0 Transaction Abort Error on Windows MySQL Garbled Text Fix: Character Set Mismatch 0XC0000212 STATUS_TRANSACTION_NO_MATCH (0XC0000212) – Quick Fix for Transport Token Mismatch 0XC000036D Fix STATUS_DRIVER_DATABASE_ERROR (0XC000036D) Fast

Was this solution helpful?

EP
Erropedia Team
Tech Support Editors
The Erropedia editorial team researches and documents real-world tech errors from across Windows, Linux, macOS, networking, databases, cloud platforms, and more. Every solution is reviewed for accuracy and updated as software and systems evolve.