Web Hosting Forum | Lunarpages


*
Welcome, Guest. Please login or register.
Did you miss your activation email?



Login with username, password and session length
April 25, 2014, 12:36:16 AM

Pages: [1]   Go Down
  Print  
Author Topic: Automatic Backup of MySQL under Windows if using Mac OS  (Read 4947 times)
shiesl
Newbie
*
Offline Offline

Posts: 2


« on: November 04, 2012, 11:05:08 PM »

There is a great article written from 2009 on many ways to automatically backup your MySQL database if you are running Windows on Lunarpages AND using a Windows machine. Unfortunately I'm running Windows on Lunarpages AND using a Macintosh machine. It's a long story. The result is I still need to backup my MySQL database on a daily basis. I do have DropBox, although I do not think that would work. I generally do run my computer 24/7, but have never ran a script that automatically does anything at anytime - although I expect I could find out how to. Suggestions are welcome. Rick
Logged
MrPhil
Senior Moderator
Berserker Poster
*****
Offline Offline

Posts: 5811



« Reply #1 on: November 05, 2012, 06:34:07 AM »

If you can give a pointer to the article, I could read it tonight and see if I can think of any solution. Does it involve a scheduled task on the Windows PC? If so, you might be able to use "cron" or something similar on the Mac. Is it using FTP or something else to automatically transfer the backup file? I know that a Linux server can schedule a cron job to create a database backup (and even tar the site files), and it's presumably possible to initiate an FTP transfer of the backup from at least one end of the connection. It should be even easier on a Linux PC, and since Mac OS X is very similar to Linux under the covers, I would think it possible.
Logged

Visit My Site

E-mail Me
  
-= From the ashes shall rise a sooty tern =-
shiesl
Newbie
*
Offline Offline

Posts: 2


« Reply #2 on: November 07, 2012, 07:46:57 PM »

Here is the main response:

Create this shell script in your FTP home directory (X:\backup.sh). Replace the xxxxxx with your passwords,  uuuuuuu with your username, and mmmmmm with your MySQL DB name, and ppppppp with your Postgres DB name. -9 means maximum compression. If you want to keep the same filename, you can get rid of the $date, {$date}, and 20?Huh??.

Code:
#!/bin/sh
rm ~/backup20?Huh??.tar.gz # remove old backup file
rm ~/backup20?Huh??mmmmm.sql.gz
rm ~/backup20?Huh??mmmmmm.sql.gz
rm ~/backup20?Huh??ppppppp.sql.gz
date=`date +%Y%m%d`
tar cf ~/backup$date.tar public_html
gzip -9 ~/backup$date.tar
mysqldump -u uuuuu --password=xxxxx mmmmmm | gzip -9 > backup${date}mmmmm.sql.gz
mysqldump -u uuuuu --password=xxxxxxx mmmmmmm | gzip -9 > backup${date}mmmmmm.sql.gz
export PGPASSWORD=xxxxxxxxx
pg_dump -U uuuu pppppppp | gzip -9 > backup${date}ppppppp.sql.gz

But it's for Windows Cron and will not work on a Mac.
Logged
MrPhil
Senior Moderator
Berserker Poster
*****
Offline Offline

Posts: 5811



« Reply #3 on: November 08, 2012, 06:10:03 AM »

The script you listed is for running on a Linux server, not Windows. I see a .tar file with your site files, and two MySQL dumps (why?) and a PostgreSQL dump. I don't see anything to download to a PC -- it appears to just leave the files on your server. It should be possible to automatically transfer backup files to any kind of PC, using FTP: Linux, Mac, or Windows. I recall seeing discussion about doing this several years ago, so it should still be around. "cron" is a Linux scheduled task utility, while Window's equivalent is something like "task scheduler".
Logged

Visit My Site

E-mail Me
  
-= From the ashes shall rise a sooty tern =-
Andys777
Trekkie
**
Offline Offline

Posts: 12


« Reply #4 on: January 01, 2014, 02:08:42 PM »

You can choose best for you at: http://top10-online-backup.com/categoriesBackup.php?c=Online+Backup+For+Servers
This table very help me some time ago.
Logged
Pages: [1]   Go Up
  Print  
 
Jump to: