0

I am using shared server hosting , please help me to know how can I schedule/automate database backup daily and backup send it over mail in excel format.

I tried cron job but its not worked. Event is not working as I am using shared server because scheduler is off need super privilege which is not possible in shared server hosting.

Dave
  • 5,108
  • 16
  • 30
  • 40

1 Answers1

0

On a shared server it can be tricky but not impossible.

One way to do it :

  • Create a PHP script that will do the database export:
    • select db info from information_schema
    • export tables structures using SHOW CREATE TABLE
    • select rows in every table, and craft the INSERT queries from that
  • Add security to this script (like specials GET parameters, so you are the only one able to run it)
  • Create a CRON / Task schedule on your own computer, to query this script daily.

If this works you can avoid creating your own script : https://gist.github.com/micc83/fe6b5609b3a280e5516e2a3e9f633675

This could be interesting too : Using a .php file to generate a MySQL dump

Also about having the scheduled task on your computer, you could put it on multiple computers, and just check in the export script if it had already been run today or not (put this info in a table, or in a file on the disk).

Loïc
  • 11,804
  • 1
  • 31
  • 49