mysqldump – export MySQL DB from Windows using WSL

mysqldump -h localhost --port=3306 --protocol=TCP -uroot -p test_countryapi > dump.sql

#bzip2
mysqldump -h localhost --port=3306 --protocol=TCP -uroot -p test_countryapi | bzip2 > dump.sql.bz2
#with datetime
mysqldump -h localhost --port=3306 --protocol=TCP -uroot -p test_countryapi | bzip2 > dump-$(date '+%Y%m%d-%H%M%S').sql.bz2

#gzip
mysqldump -h localhost --port=3306 --protocol=TCP -uroot -p test_countryapi | gzip > dump.sql.gz