Here’s a quick how to:
1. Tar up the directory:
tar cvf WordPress.tar wordpress/.
bzip2 WordPress.tar
2. Dump the database.
mysqldump --user user_name --password --host example.com --extended-insert=FALSE database_name > database_name.sql
I personally use extended-insert set to false because I often have to read the SQL.
Here is how to restore from backup:
tar zxvf WordPress.tar.bz
mysql --user user_name -p -hexample.com database_name < database_name.sql
Be sure to replace user_name, example.com and database_name with the appropriate values for your system.
I hope this helps.