Setup database backup cron job on godaddy hosting account

Many time you need to setup Cron Job to schedule specific task at regular interval. This article covering cron job setup on godaddy account. Godaddy account has different interface then traditional cpanel. These instructions apply to WordPress.com server installations. Here are the steps to take daily backup of DBS.

Here are the steps to setup cron job for daily backup of database.

  • Log Into your GoDaddy.com account.
  • Choose “My Hosting Account” from the “Hosting & Servers” menu on the top navigation bar.setup database backup cronjob on godaddy hosting account
  • In the Hosting Account list, click the Open link beside the account you want to use for your website.Godaddy Hosting Account Setup
  • In the Hosting Manager window, click the Cron Manager icon or “Cron Manager” menu item under content menu. Please refer snapshot below.Godaddy Cron Manager Setup Instruction
  • Now you are on the page where you need to setup cron job. Before this, you need to collect following information with the database..Host Name: (Usually localhost but in case of godaddy account it will be look like mysql139.secureserver.net) Database Name: Name of the backup database.
    User Name: User name of associative database. In case of godaddy account it will be same as db name.
    DB Password: Database user password for authentication.
  • Please use following mysqldump command to get backup of desired database. Please change required parameter with your own.Syntax:
    mysqldump –opt -Q -h (hostname) -u (user-name) –password=(password) (database-name) > (full path of backup file)Example:
    mysqldump –opt -Q -h p3smysql5.secureserver.net -u mywebdb –password=password mywebdb > /home/content/b/a/b/babychep/html/backups/daily.sql

    Please replace variable with new one and put entire command in command text box. No need to use browse button here. Select how you want to run these command hourly,daily,weekly and click on save button to save cron job.

    Godaddy Cron Setup Command

27 thoughts on “Setup database backup cron job on godaddy hosting account”

  1. Hi– I tried your cron recommendation, but I haven’t been successful. Here’s the error I get via email:

    ———

    Got error: 1045: Access denied for user ‘[username removed]‘@’[IP address removed]‘ (using password: NO) when trying to connect

    ———

    I do have the password there in the actual script … why does it not recognize it?

  2. Godaddy Requires that you have SSH enabled in order to run Cron Jobs from the Cron Manager tab now. This will allow you access to the database through Cron.

  3. Thanks for the great tip. I am experiencing the same issue as previous poster Matt and I have SSH enabled for my site. I also have a cron job that backups up web application on my site via a script actually on my web server that works without issue. Any help would be appreciated.

  4. I get the following error and like other post I am using a password

    mysqldump: File ‘/usr/share/mysql/charsets/?.conf’ not found (Errcode: 2)
    mysqldump: Character set ‘#33′ is not a compiled character set and is not specified in the ‘/usr/share/mysql/charsets/Index’ file
    mysqldump: Got error: 1045: Access denied for user ‘removed’@’208.109.181.75′ (using password: NO) when trying to connect

  5. Hey ive seen a lot of people having errors such as

    mysqldump: Got error: 1045: Access denied for user ‘removed’@’ip′ (using password: NO)

    i BELEIVE (at least i worked for me) that the error is in the article

    make sure you remove the -password=YourPassword
    it should be -pYourPassword… for example:
    (only a -p followed bu your password WITHOUT SPACE!)

    so the article SHOULD say something like this….

    Please use following mysqldump command to get backup of desired database. Please change required parameter with your own.Syntax:

    mysqldump –opt -Q -h (hostname) -u (user-name) –password=(password) (database-name) > (full path of backup file)

    Example:

    mysqldump –opt -Q -h p3smysql5.secureserver.net -u yourusername –pYoUrPaAsWorD yourdbname > /home/rourabsolutepath/html/backups/daily.sql

    hope you fix the error and good luck!

  6. hey everyone, here is another solution, that worked for me as well, in case you dont get the other one running… just follow all the steps listed in this article and in the cronjob field write

    mysqldump -h p3smysql5.secureserver.net -uUsErNaMe -pPaSsWoRd yOuRdBnAmE > /home/absolutepath/dump.txt

    where you need to update where it says ‘p3smysql5.secureserver.net’ for your own server address,
    ‘UsErNaMe’ with your username,
    ‘PaSsWoRd’ for your own password,
    ‘yOuRdBnAmE’ for your database name, and
    ‘/home/absolutepath/’ for your absolute path

    cheers….

  7. well, this is my third post today, but i hope it helps

    its one last small addition to my last solution

    you might also wanna add the date to the file name of the backup, just in case you dont want the file to be overidden everytime it backs itself up, you can have a copy of everyday backup….

    just ass this to the file name: dump_$(date +” “\%d\%m\%Y).txt

    so it would look like this:

    mysqldump -h p3smysql5.secureserver.net -uUsErNaMe -pPaSsWoRd yOuRdBnAmE > /home/absolutepath/dump_$(date +” “\%d\%m\%Y).txt

    where you need to update where it says ‘p3smysql5.secureserver.net’ for your own server address,
    ‘UsErNaMe’ with your username,
    ‘PaSsWoRd’ for your own password,
    ‘yOuRdBnAmE’ for your database name, and
    ‘/home/absolutepath/’ for your absolute path

    have a great day!

  8. One minor point. I am not sure if it is my browser, or something with your editor, but the commands should be:
    –opt and
    –password
    ie minus minus
    not a long dash. I think that this is what is causing some of the problems.

    Thanks though, once I figured this, it solved my issue.

  9. Thanks for the tips. I tried to use all the notes here to get it to work and FINALLY did with some tweaking.

    First off: with Godaddy you need to be using SSH! Make that switch first, this will take a couple of days.

    2nd my cron job is as follows:
    mysqldump –opt -Q -h yourdomainname.com -uusername -pPassword databasenamesameasusernameusually | gzip > /home/content/a/b/c/abc/html/backups/databasebackup_`date +\%Y\%m\%d\%H\%M\%S`.sql.gz

    Keep in mind: no space between the -u and username. no space between the -p and password. Also for the date code, backword slashes (\) before the % signs. Hope this helps others.

  10. How do I find my “absolute path?” I don’t see it listed in the control panel and don’t know its exact sequence. I’m assuming I can’t just use a http:// etc…?

  11. I kept having issues with the syntax. Not sure if they use different version of whatever software. What did work was:

    echo “Backing up WordPress database”
    mysqldump -h YOUR.DBSERVER.COM -uUSERNAME -pPASSWORD DATABASENAME > $HOME/html/backups/database/$NOWDATE.sql
    gzip -9 $HOME/html/backups/database/$NOWDATE.sql
    echo
    echo “Job finished!”

    I found this on a site whilst looking at yours (http://www.fortasse.com/2010/01/tutorials/tutorial-automatic-backup-script/). I used a combo of yours and his.

    Also,

    if you are using Windows PLEASE make sure to use a GOOD text editor such as EditPad Lite or maybe just use dos2unix or unix2dos. Both can be found in most distros and you can also use online versions

    Cheers,

    JB

  12. Thanks to this post I was able to get mine working! To return the favor, here’s some help:

    ANSWERS TO QUESTIONS
    ——————–

    If you’re getting the “Access Denied” message, try removing the “-opt -Q” part of the query. That worked for me!

    To get the full path, you can SSH into your server (as other people have said, you need SSH for this to work) and from the directory you want the path of, type “pwd” and hit enter: it will echo it back to you.

  13. Great post. I just setup my backend so I could backup using php (just click a single link and wham..).. But, cron will do the remembering for you. So, when godaddy tells you it will be 3 to 9 days before they can get your website backup, you can make other arrangments.

  14. I am not an experienced person when it comse this. I was given a cron job script to run within Godaddy and am trying to use it…
    mysqldump –opt -Q -h (database login) -u (loginname) –password=(yourpassword) (nameofdatabase) > (absolutepath/DBNAME_`date ‘+%m-%d-%Y_%H-%M’`.sql)

    I do not know how to determine absoulte path here. Path to where? Is this to store a copy of database on the database server or what? please help.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>