I'm trying to make a script to run via cron to backup my moodle database in mysql. However, I'm unable to get it to accept the password on the command line. (?) I'm trying to run the following command:
#!/bin/sh
date=`date '+%y-%m-%d'`
mysqldump -u root -pmy_pwd -p -C -Q -e -a moodle > /volume/storage/bkup/moodlebkup/moodle-backup-$date.sql
When I run this script, it prompts me for the password even though I've already put it in the command line. I've even tried using --password=my_pwd and get the same thing? When I run mysql -u root -pmy_pwd, it logs in without prompting for a password to mysql perfectly. What am I missing here?
So I'm using mysql 5.0.48 on centos (rhel) 4.