release
12 min read

How to Import Large MySQL Databases in MAMP Using Terminal

Importing a large MySQL database into MAMP often fails in phpMyAdmin because of strict file size limits. Even increasing PHP values in php.ini won’t reliably handle 100 MB+ database dumps. The most effective way is through the Terminal.

Migrating a large MySQL database into your local MAMP environment can be frustrating — especially when phpMyAdmin’s upload limit caps out at only 8 MB. If your database is 100 MB or larger, uploads via the browser will almost always fail.

In this guide, you’ll learn how to bypass those limitations and import large SQL dumps directly into MAMP using the Terminal.

Why phpMyAdmin Fails With Large Files

By default, MAMP sets PHP upload limits that affect phpMyAdmin:

  • post_max_size → 8 MB
  • upload_max_filesize → 32 MB

Even if you raise these values in a php.ini file, phpMyAdmin still struggles with big files (100 MB+) and may crash due to timeouts or plugin dependencies in WordPress databases.

That’s why the Terminal method is the most reliable.

Step 1 – Prepare Your SQL File

Export your live site’s database:

  • Use your host’s phpMyAdmin or a WordPress plugin.
  • The export is often compressed (.zip or .gz).
  • Extract it until you have a .sql file.

Step 2 – Start MAMP

  1. Launch MAMP.
  2. Click Start to run Apache and MySQL.
  3. Verify that the MySQL server is active (green button shows “Stop”).

Step 3 – Connect to MySQL via Terminal

Open Terminal (Cmd + Space → Terminal) and connect using the command that matches your MAMP version:

MAMP v6 or lower:

/Applications/MAMP/Library/bin/mysql --host=localhost -uroot -proot

MAMP v7+ with MySQL 5.7:

/Applications/MAMP/Library/bin/mysql57/bin/mysql --host=localhost -uroot -proot

MAMP v7+ with MySQL 8.0:

/Applications/MAMP/Library/bin/mysql80/bin/mysql --host=localhost -uroot -proot

You should see the mysql> prompt.
Default credentials: username = root, password = root

Step 4 – Create a Database

Inside the MySQL shell, create a new database (use the same name as your live site’s database):

CREATE DATABASE test_db;
SHOW DATABASES;
USE test_db;

You should see “Database changed”.

Step 5 – Import the SQL File

Now import your large .sql file. Run:

SET autocommit=0;
SOURCE /Applications/MAMP/htdocs/test_db.sql;
COMMIT;

👉 If you’re unsure of the path, type SOURCE (with a space) and drag your SQL file into Terminal. It will auto-fill the file path. Then finish with ; COMMIT;.

Example:

SET autocommit=0;
SOURCE /Users/yourname/Desktop/live_dump.sql;
COMMIT;

You’ll see the queries being executed as the database is imported.

Step 6 – Verify in phpMyAdmin

  1. Open http://localhost/phpmyadmin/.
  2. Select your database (e.g., test_db).
  3. All tables should now appear.

If this is a WordPress database, update URLs from the live domain to localhost before testing your site.

Step 7 – Run Your Local WordPress Site

Final Notes

  • Windows users: Use Command Prompt or PowerShell with the equivalent MySQL binary path.
  • Adminer users: The same import command works.
  • Raising PHP limits in php.ini may help with small imports but won’t solve issues with very large databases.

The Terminal import method is fast, reliable, and bypasses phpMyAdmin’s upload limits completely.

With this workflow, you can import even multi-hundred-megabyte databases into MAMP without errors. Perfect for local WordPress development or migrating large projects.

Share: