Transfer database and tables from one server to another

Doing a migration but not sure how to transfer databases? If you are using mysql or mariadb you could give a try to the next command.

Description: Useful command to transfer database and tables from one server to another.

 bash | 
 
 copy code |
?

1
mysqldump --opt --compress --user=USERHERE --password=PWHERE --host=SOURCE.HOST.HERE SOURCE_DB_NAME | mysql --user=USERHERE --password=PWHERE --host=TARGET.HOST.HERE -D TARGET_DB_NAME -C TARGET_DB_NAME