Find out how to export and import a MySQL database from command line.
Sometimes it is required to transport a MySQL database accross different servers. Often it is required to make backups of MySQL databases. Here are the commands to import and export.
To export, we use mysqldump:
mysqldump -u Username -pPassword DatabaseName > DatabaseName_backup.sql
To import, we can feed the content of the generated .sql file to the mysql command line client:
mysql -u Username -pPassword DatabaseName < DatabaseName_backup.sql