Source: https://dev.mysql.com/doc/refman/8.0/en/mysqldump.html
Dump
mysqldump -u user -ppassword my-database
Import
mysql -u username -p database_name < file.sql
Dump and archive database
mysqldump -u user -p my-database | gzip > dump.sql.gz
Import database
gunzip < dump.sql.gz | mysql -u user -ppassword my-database