Export or import MySQL database dump

Sometimes it’s not enough to import or export database dump with PHPMyAdmin. For example if file is too big we should use command line tool.

So to export mysql dump via terminal we should type:

mysqldump -u {user name} -p{password} {database name} > ./{exported database name}.sql

To export from remote host:

mysqldump -h {remote host} -u {user name} -p{password} {database name} > ./{exported database name}.sql

To import dump:

mysql -u {user name} -p{password} {database name} < ./{database name}.sql 

Note: do not type brackets-{}, I used it to separate command from explanations.