MySQL command line import/export

Standard

Export

mysqldump -u username -p database_name > dbname.sql

 

Import

mysql -p -u username database_name < dbname.sql

 

Replace username with the database username
Replace database_name with the name of the database

Condition of the above working is, that you are logged into the Linux server (by ssh or console) that runs the MySQL database and that you have the password relevant to the database user.