You first need to locate the mysql binary.
$ cd /Applications/MAMP/Library/bin
then access the database
$ ./mysql -u <username> -p <dabataseName>
Note in MAMP: <username> = root
When asked for a password enter root
mysql> source <path/to/file>.sql
Sources:
http://stackoverflow.com/questions/15278375/importing-larger-sql-files-into-mysql
http://stackoverflow.com/questions/9335403/access-mamps-mysql-from-terminal