import / export mysql database

Export mysql database

mysqldump -u [username] -p [database name] > [database name].sql

Get it from server, if you need:

scp user@remotehost:/remotedirectory/remotefile /localdirectory/

Import it:

CREATE DATABASE newdatabase;

Then log out of the MySQL shell and type the following on the command line:

mysql -u [username] -p[password] newdatabase < [database name].sql

Thanks to: https://www.digitalocean.com/community/tutorials/how-to-import-and-export-databases-and-reset-a-root-password-in-mysql