bash script to backup mysql

#!/bin/bash
mydate=$(date | tr " " "-");
mydb="yourdbname"
mysqldump $mydb > $mydb-$mydate.sql
gzip $mydb-$mydate.sql

Make a user that only has dump privileges
name it backup.sh Edit the ~/.my.cnf and add the following

[mysqldump]
user=theusername
password=thepassword

crontab -e

0 * * * * sh backup.sh

this will run the backup hourly.