Blog
MS SQL and MySQL Database Backups on Rackspace Cloud
October 7, 2010 Author: Jessica
Recently, I was asked to setup an automatic database backup process for some cloud sites. Not having much experience with database backup, let alone setting up an automatic process. I plowed ahead on the project.
I was directed to this link for the MS SQL Databases: http://cloudsites.rackspacecloud.com/index.php/How_can_I_create_a_cron_job_to_backup_my_MSSQL_database%3F
Following the above link was more than helpful. Although, I still ran into an error after running through the directions. “curl: (6) Couldn’t resolve host ‘backupdb.asp’ ” My first mistake was, I was using the linux path instead of the windows unc path in the backup.asp file. My second mistake was I didn’t enter a full url for the command to run in the cron job setup. After fixing those simple mishaps, I now have an automatic backup running for my sites.
For MySQL Databases, I was directed to this site: http://cloudsites.rackspacecloud.com/index.php/How_do_I_create_a_cron_job_to_backup_my_MySQL_database%3F
I can’t say that I’m at all familiar with shell scripting or that I even know what the code is really doing. For the MySQL Database process I did wonder off the directed path and had found another backup tool, phpMyBackupPro (http://www.phpmybackuppro.net/). This tool can be easily installed on your site and will create an automatic backup for you. Using this tool for multiple sites isn’t what it was designed for, unless you want to install this tool on each site. No thank you.
After that little adventure, I got back on my directed path. The error I found this time was “No such file or directory”. After reviewing the shell script multiple times, I couldn’t find anything wrong. I did some searching and found this:
#!/bin/bash
Backupdir= *******.com/backups
backupfile=`date +backup-%d-%m-%y_%H.sql`
tarfile=mysqlbackup.tar
cd $backupdir
mysqldump –opt -A -h ******** –password=****** -u ******* > $backupfile
gunzip “$tarfile”.gz
tar rf $tarfile $backupfile &> /dev/null
gzip $tarfile
rm $backupfile
*replace the “*” with actual information
I plugged in the information for the script then continued setting up the cron job per the original directions in the above link. The first time this script runs, you will get a “File Not Found”. Run the script a second time and the error is gone. I’m now getting automatic backups of my MySQL Databases.
-
Categories
- asp.net (13)
- Blog (3)
- Business (6)
- Conferences (1)
- Errors (7)
- Office (1)
- Portfolio (3)
- Reviews (3)
- SEO (4)
- SQL Server (4)
- Tips (2)
- Uncategorized (3)
- Web Development (18)
-
Archives
- October 2012
- August 2012
- July 2012
- June 2012
- May 2012
- April 2012
- January 2012
- December 2010
- November 2010
- October 2010
- September 2010
- August 2010
- June 2010
- May 2010
- April 2010
- March 2010
- February 2010
- January 2010
- December 2009
- November 2009
- October 2009
- September 2009
- August 2009
- July 2009
- June 2009
- April 2009
- March 2009