Last Updated: February 25, 2016
·
712
· rainphp

Import big MySql databases with command line

SSH your server and dump the database in your website folder

ssh root@yourserver.com 'mysqldump -u db_username -p db name > /var/www/vhosts/mysite.com/shop/filename.sql'

download filename.sql with curl

curl -Ov http://trendland.com/dbbk/filename.sql

and finally import into your local database

mysql -p -u db_username db_name < filename.sql

If you use MAMP your mysql is here

/Applications/MAMP/Library/bin/mysql

Note: you may want to use rsync instead of curl