How to import or export MySQL database with command line.
This is also useful when working with big databases.

Export database info file

mysqldump DATABASE-NAME > FILE-NAME.sql

Export database into compressed file to save space

mysqldump DATABASE-NAME | gzip FILE-NAME.sql.gz

Export database into compressed file with date name to save space

mysqldump DATABASE-NAME | gzip > "FILE-NAME_`date +%e_%b_%Y`.sql.gz"

Import database

mysql DATABASE-NAME < FILE-NAME.sql
mysql mojtest_test1 < mojtest_test1.sql

How to create MySQL/MariaDB database and user