mysqldump --all-databases > allDB.sql
The above dumps ALL the mysql databases to "allDB.sql" but you could save a lot of space using gzip.
If you want to compress with gzip you could do this instead:
mysqldump --all-databases | gzip > ALLDB.sql.gz
To restore the compressed backup do this:
gunzip ALLDB.sql.gz | mysql -u youruser -p
........