The following will create a gz compressed SQL dump from your chosen database
# mysqldump --lock-tables --opt DBNAME -u UNAME --password=PASS | gzip > OUTFILE
An alternative is to use mysqlhotcopy
This will make a hotcopy of SQL database files instead of a dump to a text file, you can use the mysqlhotcopy tool. This tool locks a table, copies it and than unlocks again.
If you want to transfer the MySQL data to a directory on the same server.
# mysqlhotcopy --user=UNAME --password=PASS DBNAME PATH
If you want to transfer the MySQL data to an other server with SSH
# mysqlhotcopy --method=scp --user=UNAME --password=PASS DBNAME PATH SSHUSER@SSHSERVER:PATH
tip: add this to your crontab for scheduled backups