MAMP, import db by command line

  1. Open a new terminal windows
  2. /applications/MAMP/library/bin/mysql -u [USERNAME] -p [DATABASE_NAME] < [PATH_TO_SQL_FILE]
  3. Hit the Enter Key
  4. Example: /applications/MAMP/library/bin/mysql -u root -p wordpress_db < /Applications/MAMP/htdocs/backupDB.sql
  5. Quick Tip: You can simply drag the file into the terminal window and it will enter the location of the file for you.


If ask you a password, insert the database ones.


That’s all folks.