MAMP – PHPMYADMIn import / export dump from terminal

EXPORT:

  • Open a new terminal window
  • Navigate to the MAMP install by entering the following line in terminal cd /applications/MAMP/libary/bin Hit the enter key
  • Write the dump command ./mysqldump -u [USERNAME] -p [DATA_BASENAME] > [PATH_TO_FILE]
  • Hit the enter key Example: ./mysqldump -u root -p wp_database > /Applications/MAMP/htdocs/project_name/db_name.sql
  • Terminal should ask, after you hit enter, to enter your password Enter password:
  • Go to folder that you have specified before and you find your db dump.

IMPORT :

  • Open a new terminal window
  • Enter following line in terminal /applications/MAMP/library/bin/mysql -u [USERNAME] -p [DATABASE_NAME] < [PATH_TO_SQL_FILE] . Example: /applications/MAMP/library/bin/mysql -u root -p db_name < /Applications/MAMP/htdocs/backupDB.sql
  • Terminal should ask, after you hit enter, to enter your password Enter password:
  • Navigate to phpMyAdmin in a browser and check if you database was successfully imported