Maybe this is a MySQL question, maybe not...
I've written a shell script to back up a database.
But when I run it, it prompts for password even though the script provides it. If I'm doing this manually, it's not a problem, but I want to make a cron job to do it...
Here's the script:
#First let's rotate the backup files...
/bin/mv /home/cabazio/someDB-3.tar.gz /home/some/someDB-4.tar.gz
/bin/mv /home/some/someDB-2.tar.gz /home/some/someDB-3.tar.gz
/bin/mv /home/some/someDB-1.tar.gz /home/some/someDB-2.tar.gz
/bin/mv /home/some/someDB.tar.gz /home/some/someDB-1.tar.gz
#Now let's make the SQL dump. We could use the root pass, but let's be conservative...
mysqldump --add-drop-table -u SOME_user -p XXXXX someDB > someDB.sql
#A little shorthand to save typing. Not required.
#And now we wrap it all up in a big tar ball...
/bin/tar -cvzf /home/some/someDB.tar.gz $LOGFILE
#Zero out the original dump, we don't need it.
echo "" > $LOGFILE
I've also tried with this line:
mysqldump --add-drop-table someDB > someDB.sql
How do I accomplish this without the PWD prompt (I already provide it, why does it ask?) Obviously, if a cron job is executing this in the middle of the night, I'm not around to provide the PWB...
This is with MySQL v. 5.0.58 on CentOS v. 5