cd /Applications/MAMP/Library/bin
./mysql -uroot -proot
connect your_database_name
source /path/to/your/file/sql_export.sql
/////////////////
$ mysqldump -u [uname] -p[pass] db_name > db_backup.sql
If it's all DBs, then:
$ mysqldump -u [uname] -p[pass] --all-databases > all_db_backup.sql
If it's specific tables within a DB, then:
$ mysqldump -u [uname] -p[pass] db_name table1 table2 > table_backup.sql
You can even go as far as auto-compressing the output using gzip (if your DB is very big):
$ mysqldump -u [uname] -p[pass] db_name | gzip > db_backup.sql.gz
If you want to do this remotely and you have the access to the server in question, then the following would work (presuming the MySQL server is on port 3306):
$ mysqldump -P 3306 -h [ip_address] -u [uname] -p[pass] db_name > db_backup.sql
It should drop the .sql file in the folder you run the command-line from.
mysql -u bn_magento -p dbnamehere -S /opt/magento-1.9.2.4-3/mysql/tmp/mysql.sock < db_backup.sql
https://stackoverflow.com/questions/13484667/downloading-mysql-dump-from-command-line