Click to See Complete Forum and Search --> : Bash script, is this possible??


=TSW=Illegal
10-12-2003, 10:17 PM
Hello

I would like to make a simple bash script that will do a dump of MYSQL database as a backup via cron once a day.

However there is one severe limitation, MYSQL requires that the user type his password to continue.



What are my options of getting around this limitation so that I do not have to be present to make this happen?



Thanks in advance for any alternitive ideas.

stoe
10-13-2003, 10:17 AM
the --password=passwd CL switch maybe of some use, for example:


mysql --user=user_name --password=passwd db_name

sharth
10-13-2003, 11:15 AM
I'd also make a seperate account with read-only access, for a bit of security purposes.

=TSW=Illegal
10-13-2003, 03:12 PM
I was unaware that MYSQL was able to take the username and password as direct arguments, I was able to solve it by adding to my script

mysqldump --user user --password --mypassword nameofforum>$HOME backup.sql

This worked like a champ and restored just fine