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

Import compressed database .gz file

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

How to create MySQL/MariaDB database and user

For importing very big databases maybe you will also need to add this into /etc/my.cnf.d/server.cnf under [mysqld]

wait_timeout = 86400
max_allowed_packet=256M