Page 1 of 1
PHP Script for MySQL Backup
Posted: Fri Aug 03, 2007 4:29 am
by legend986
My host does not provide me with Shell Access nor access to SQL Binary Logs. Is there a way I could get incremental backups of my database?
Posted: Fri Aug 03, 2007 7:00 am
by dillion
Are you able to write cron jobs (maybe via their control panel)?
Posted: Fri Aug 03, 2007 7:58 am
by legend986
Yeah I think I can do that... But I'd like to know how to do it manually with a php script along with a cron

Posted: Tue Aug 07, 2007 3:17 am
by legend986
Someone please?
Posted: Tue Aug 07, 2007 6:39 am
by robshanks
You can use software - I like MySQL Auto Backup
http://www.mysqlautobackup.com/
You can write a php script manualy or install phpmyadmin
http://www.phpmyadmin.net/home_page/index.php and look at the php code generation features along with the export functions the software has and between the two you will be able to create a php script to back up your database to a sql file.
Posted: Tue Aug 07, 2007 10:28 am
by legend986
Thank you so much... But did I miss out on the Incremental Backups? I couldn't find that in the features list anywhere in the first link you provided

Posted: Tue Aug 07, 2007 1:06 pm
by robshanks
I use the Pro version and it does incremental backups.
I find it good as I do an hourly clone to my backup server, 6 hourly incremental backups, and a nightly full backup, all with the software running a service on my backup server and I can basically forget it

Posted: Tue Aug 07, 2007 1:33 pm
by legend986
I see its not a free script

Posted: Tue Aug 07, 2007 2:27 pm
by robshanks
No it isn't but for me I found the peace of mind worth the expense, and when the hosted server I had a customers site on went down for 12 hours during the floods here in the UK I had them up and running again in 15 minutes on my backup server.
Posted: Wed Aug 08, 2007 3:38 pm
by legend986
Well, yeah I'm sure you must be enjoying that script... But well, I'll keep searching for some free one... Thanks for all the help...
Posted: Wed Aug 08, 2007 4:11 pm
by impulse()
I'm not sure, but I imagine you can still run shell commands using the exec command. It may be worth running a test, and if that's successful, using mysqldump. There's no reason why you couldn't be able to create the backup and move it into a web folder and download it over HTTP.
But as I say, I'm not sure what happens when you use exec, system or shell_exec when shell access is disabled.
Regards,
Posted: Thu Aug 09, 2007 10:33 am
by legend986
Tried it but maybe I'm not using it right... Will keep trying that anyways...
But just for learning new things, I wanted to know this technique please...
I've seen a few scripts repeat themselves repeatedly to complete the execution. For example, they keep dumping the database onto the webserver itself, refreshing the script itself. And before each refresh, it dumps around 2000 queries or say executes for around 15 seconds and then refreshes and then resumes... I want to know how this is done... Any advice please?