I had a similiar problem when I was setting up a database dump to be run to cron. I change the order of things around a bit from the Dreamhost K-base. I also had a issue with remembering the passowrds I had used. I ended up creating an additional user for a couple of my databases to work around this. You can always double check if you think this might be an issue by logging into phpmyadmin.
Also double check, if you're using a text file, that the line is not wrapping. you can use nano -w textfile.sh to edit the file so it shouldn't wrap.
Anyways, here's the basics of the script I use, see if it helps you.
mysqldump --opt -uUser -pPass -h host.domain.com database_name > file/locationl/database.$suffix.sql
(edit: the suffix thing creates the files with the current date in the file name string. Helpful if this is a regular process.)