How do I export/import large database on MAMP ? Using PHPMyAdmin does not work as it supposed to be.
4 Answers
It should be done via terminal as below.
- In the terminal navigate to
bin
folder of MAMP using below commandcd /Applications/MAMP/library/bin
- Use this command to export the file
./mysqldump -u [USERNAME] -p [DATA_BASENAME] > [PATH_TO_FILE]
. EG would be./mysqldump -u root -p my_database_name > /Applications/MAMP/htdocs/folder_name/exported_db.sql
- Line should appear saying
Enter password:
. Here enter the MySQL password. keep in mind that the letters will not appear, but they are there.
If you need to import use BigDump Which is a MySQL Dump Importer.

- 20,081
- 13
- 69
- 93

- 44,706
- 42
- 157
- 243
-
And how do you import? – Evanss Feb 11 '15 at 10:33
-
You can also Import using a command similar to the export. You can read here: http://nickhardeman.com/308/export-import-large-database-using-mamp-with-terminal/ – Lucas Healy Mar 21 '17 at 23:19
Turn on MAMP!
Then, for both operations, open the terminal and type:
EXPORTING:
/Applications/MAMP/library/bin/mysqldump -u [USERNAME] -p [DATABASE_NAME] > [PATH_TO_SQL_FILE]
Then type your password in prompter (default root
) and press enter.
Example:
/Applications/MAMP/library/bin/mysqldump -u root -p my_database_name > /Applications/MAMP/htdocs/folder_name/exported_db.sql
IMPORTING (will erase current database):
/Applications/MAMP/library/bin/mysql -u [USERNAME] -p [DATABASE_NAME] < [PATH_TO_SQL_FILE]
Then type your password in prompter (default root
) and press enter.
Example:
/Applications/MAMP/library/bin/mysql -u root -p my_database_name < /Applications/MAMP/htdocs/folder_name/exported_db.sql
/!\ Important Warning: Make sure to backup your current database before doing this command in case you need a copy of it before importing. This will erase your current database!

- 2,575
- 2
- 29
- 45
You can also use the Sequel Pro App if you are using MAMP PRO version to get around the defaults that phpMyAdmin gives you.
I had a problem to dump my db from MAMP. Tried a lot of things, but always this error: Got error: 2002: Can't connect to local MySQL server through socket '/Applications/MAMP/tmp/mysql/mysql.sock'
Tried to create a symlink, but it was already created "ln: /tmp/mysql.sock: File exists"
Thought the problem was new Mac or new MAMP. Finally in my case (problem was in me) solution was really simple: just turn on MAMP :) Maybe it will help someone to save a little bit time (I spent around 4 hours)

- 45
- 7