Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This question already has an answer here:

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..

share|improve this question

migrated from Aug 20 '09 at 12:52

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

marked as duplicate by Ladadadada, Cakemox, growse, MDMarra, Michael Hampton May 19 '13 at 14:57

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

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.

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