I’ve really come late to this party. :\ I’ve tried my best to read through everything, so if I repeat something, please forgive me.
The problem, as I understand it, is managing automated backup procedures for your MySQL database. I went through the whole business of writing code to be run on the host via cron, and then FTP the result to my home server. Your situation may be quite different, but here is what I did to resolve the problem to my satisfaction.
What I needed was a process to be run on a schedule that would backup my MySQL database onto a computer here at home. (It could be a computer anywhere, really.) I have a server running WinXP Professional, in this case. I downloaded and use a product called “ncron” to run on WinXP. (It was designed for NT.) I then wrote a script to run on a schedule. Locally, I maintain a MySQL server. It is not specifically required for what I need, but the utility “mysqldump” is.
I created a script that includes the following:
C:
cd C:\ . . . . \MySQL4\bin
mysqldump <database name> -h <database URL> -u <database userID> -c -e --add-drop-table --password=<database password> --compress --single-transaction --result-file=D:\hosts\. . . \mysql-backup\<mywebsitename>.sql
. . . (plus some gzip stuff)
Let’s call that script “backup.bat”. I then added an entry in the ncron schedule file such as:
#0 0,6,14,18,20 * * * c:\www\MySQL4\bin\backup.bat
The cron job is then run at the prescribed hours and runs the mysqldump program. It connects to Lunarpages MySQL server and runs the backup query. The compressed result is received by my server, then stored and compressed with gzip.
For this to work you must take care to insure that your home (or other) server’s address is listed on the CPanel page for MySQL Databases / Access Hosts. If set up correctly, your home server (or desktop for that matter) will connect to Lunarpages, run a backup query on your MySQL database, and store a copy safely on your computer.