Reputation: 133
I would like to setup a daily auto backup of my online myphpadmin database. The backup can be stored on my PC (which is turned on most days) or online somewhere (within myphpadmin somewhere?)
What is the easiest way to achieve this? myphpadmin has an event scheduler, but requires SQL instructions - but I cant find the commands necessary to make this work.
Thanks for your help
Upvotes: 0
Views: 691
Reputation: 476
This may depend on your hosting. But i solved it like this:
Create script, eg. backup.sh, with 777 rights, in some not publicly accessible folder
#!/bin/sh
#change directory to your backup directory
cd /home/xxx/backup_dbs/;
#get backup of database of applications
mysqldump --user='myuser' --password='mypw' mydb >tmp_db.sql;
#compress it in zip file
zip app_database-$(date +%Y-%m-%d-%H:%M).sql.zip tmp_db.sql;
#remove sql file
rm -rf tmp_db.sql;
#delete backups older than 20 days
find /home/xxx/backup_dbs/app* -mtime +20 -type f -delete;
and then schedule it via cron jobs
/home/xxx/backup_dbs/backup.sh
It does work on a VPS as well as another cheap reseller account i have. If it doesn't, maybe you just have to call up your hoster to activate execution of shell scripts for you.
Upvotes: 1