up vote 1 down vote favorite
share [g+] share [fb]

I am using mysqldump command to take backup of my database.

mysqldump --add-drop-table -u user -ppassword databasename > backup/mybackup_$(date +%d%m%Y_%H%M).sql

and it works fine...But i want to automate this so that it can take a backup once in every two days or something..for this i am using crontab..

15 2 * * * mysqldump --add-drop-table -u user -ppassword databasename > backup/mybackup_$(date +%d%m%Y_%H%M).sql

but this is giving me an error in putty saying command not found..any idea why?? Please help me..

link|improve this question
feedback

migrated from stackoverflow.com Aug 20 '09 at 12:52

This question came from our site for professional and enthusiast programmers.

1 Answer

Use the complete path to mysqldump, e.g. /usr/bin/mysqldump.

As suggested by the comments, it's a very good idea to use an absolute path for the destination file as well.

link|improve this answer
how do i find the complete path?? – Sakura Aug 20 '09 at 11:09
1  
which mysqldump – earl Aug 20 '09 at 11:10
type 'which mysqldump' at a command prompt – pavium Aug 20 '09 at 11:10
2  
I would use a complete path for the output file, too. – Dennis Williamson Aug 20 '09 at 13:15
feedback

Your Answer

 
or
required, but never shown