Web Hosting Talk







View Full Version : MySQL Backup script


Surfer
04-14-2001, 07:46 AM
Hi,

I was wondering if there is a script for a RAQ4i that can daily do a MySQLdump on a few databases and then login and FTP them to a external account. Since it's only my MySQL datatabases that need to be updated daily I don't need a full backup!

Thanks

kunal
04-14-2001, 10:40 AM
i dun think there is anything like this available right now.. it would be easy to right one though...

thewebbie
04-14-2001, 11:12 AM
This is very simple..

Create a script that does something like the following and add it to your daily cron.

#!/bin/sh
mysqldump -uusername -ppassword database > /tmp/database.txt
gzip /tmp/database.txt

ftp -n ftp.servername.com << EOF
user username password
bin
put database.txt.gz
EOF

mv /tmp/database.txt.gz database.txt.gz.backup

---------------End File---------------

This is just an example and you could do alot more like date the files or use ncftp etc...

Surfer
04-14-2001, 01:21 PM
Thank you for your replies...!

Is a script just a text file in the cron?

How would it work with overwriting the file on the FTP archive?
What is ncftp?

When you do this command:
mv /tmp/database.txt.gz database.txt.gz.backup

Won't the backup files get over written?

Thanks for your help!

eva2000
04-14-2001, 03:59 PM
i use the one at http://vbulletin.com/forum/showthread.php?s=&threadid=4256