How to automate a MySQL database backup on a hosted service? Cron job not working – Databases – SitePoint Forums

I’ve a web site on a shared internet hosting service supplier (Bluehost). While they’ve many instruments obtainable, I’m not in a position to establish a instrument for automating database again-ups.

I’m additionally very new to programming / understanding the whole lot about net servers and databases. I do know that my webserver is a LAMP stack.

Based on some Google searches, I attempted to accomplish this with a scheduled cron job, however it’s not working. I’m not positive my syntax and/or pathing is inaccurate. Here is the error message I get once I attempt to run it:

/bin/sh: /dwelling/example1_myusername/db_backup_exampledb1.sql: No such file or listing

I’m not in any respect accustomed to the right syntax, and maybe my path is flawed too.

I’ve create a couple databases for my website. When I create a database by means of the positioning wizard, the database title is comprised of two components (i.e: example1_exampledb1 and example1_exampledb2 )

I’m unsure if the database is “example1” or of it’s “example1_exampledb1”. When I log into phpMyAdmin, within the left navigation pane it reveals me the title of: example1. Then underneath that, there are two expandable + buttons, one for exampledb1 and one for exampledb2.

The cron job syntax I’m working (which I acquired from a Google search on the web) is:

/usr/bin/mysqldump -uexample1_exampledb -pmyPassWord dbname > /dwelling/example1_myUserId/db_backup_forumdata$date.sql

Can somebody please both advise how I can alter my cron job to make this work, or alternatively establish one other method which I can automate database again ups?

They seem to have an automatic Site Backup and Restore instrument that covers your database tables.

Perhaps this can assist.

Related Posts