Greenguy's Board


Go Back   Greenguy's Board > Programming & Scripting
Register FAQ Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
Old 2003-08-27, 08:20 AM   #1
Cleo
Subversive filth of the hedonistic decadent West
 
Cleo's Avatar
 
Join Date: Mar 2003
Location: Southeast Florida
Posts: 27,936
Lightbulb Backing up…

Drives fail, mistakes are made, are you backing up all of your work?

For most webmasters backing up their web folder is enough, but for sites that use a MySQL database backing up their web folder does not back up their database.

Let's say you have a database named MYDATA and its password is 1234 that you would like to back up.

First FTP into your server and create an empty text file named MYDATA.sql and CHOMD this file 777.

Then log into your server useing telnet or SSH and at the prompt type: mysqldump -uMYDATA -p123456 --opt MYDATA > path_to_MYDATA.sql. You can then download this file to your local drive for safe keeping.

To restore your database this is what you would do. Log into your server useing telnet or SSH and at the prompt type mysql -u MYDATA -p MYDATA < path_to_MYDATA.sql and after entering your password your database will be restored.

It is very easy using crontab and a short script to have your server do daily dumps that you can download for self keeping.
__________________
Free Rides on Uber and Lyft
Uber Car: uberTzTerri
Lyft Car: TZ896289
Cleo is offline   Reply With Quote
Old 2003-08-27, 09:09 AM   #2
amber438
Whatever don't kill ya makes ya stronger...
 
amber438's Avatar
 
Join Date: Apr 2003
Location: New York
Posts: 820
Send a message via ICQ to amber438
Quote:
Then log into your server useing telnet or SSH and at the prompt type: mysqldump -uMYDATA -p123456 --opt MYDATA > path_to_MYDATA.sql. You can then download this file to your local drive for safe keeping.
ok..dummie question of the day

path_to_MYDATA.sql is the path to the text file you just made, correct? (never did a cron thing before..)
__________________
Red Hot Links
Red Hot Galleries
amber438 is offline   Reply With Quote
Old 2003-08-27, 09:16 AM   #3
Cleo
Subversive filth of the hedonistic decadent West
 
Cleo's Avatar
 
Join Date: Mar 2003
Location: Southeast Florida
Posts: 27,936
Quote:
Originally posted by amber438
path_to_MYDATA.sql is the path to the sql database you are backing up, correct? (never did a cron thing before..)

No, that is the empty file that you created and then did a dump to or the file that you uploaded from your local backup that you kept in case your server took a shit.

So if your path to your web folder looks something like this, /home/cleo/web and you put your backup in your home folder the it would be /home/cleo/MYDATA.sql

There is no path involved with MySQL, just a call to it on your server.

On my server I have each of my databases do a dump at something like 3am into a file named after the day of the week. I then download these files to my local machine once a week. At most I would loose a few days of data if my server's drive died.
__________________
Free Rides on Uber and Lyft
Uber Car: uberTzTerri
Lyft Car: TZ896289
Cleo is offline   Reply With Quote
Old 2003-08-27, 09:21 AM   #4
amber438
Whatever don't kill ya makes ya stronger...
 
amber438's Avatar
 
Join Date: Apr 2003
Location: New York
Posts: 820
Send a message via ICQ to amber438
kewlies..thanks


__________________
Red Hot Links
Red Hot Galleries
amber438 is offline   Reply With Quote
Old 2003-08-27, 09:59 AM   #5
DangerDave
Bonged
 
DangerDave's Avatar
 
Join Date: Mar 2003
Location: BrisVegas, AUSTRALIA
Posts: 4,882
..and for those that are telnet/ssh/sql-challenged..

Get PhpMyAdmin - http://www.phpmyadmin.net/

backups are even simpler.

DD
__________________
Old Dollars >>>> Now with over 90 Hosted Free Sites <<<<
DangerDave.com.au - Adult Links to Free Porn
DangerDave is offline   Reply With Quote
Old 2003-08-27, 10:05 AM   #6
Cleo
Subversive filth of the hedonistic decadent West
 
Cleo's Avatar
 
Join Date: Mar 2003
Location: Southeast Florida
Posts: 27,936
Quote:
Originally posted by DangerDave
Get PhpMyAdmin - http://www.phpmyadmin.net/
I always found that much harder to use then pasting a couple of lines of text into a shell, but to each their own.
__________________
Free Rides on Uber and Lyft
Uber Car: uberTzTerri
Lyft Car: TZ896289
Cleo is offline   Reply With Quote
Old 2003-08-27, 10:59 AM   #7
DangerDave
Bonged
 
DangerDave's Avatar
 
Join Date: Mar 2003
Location: BrisVegas, AUSTRALIA
Posts: 4,882
Vers 2.5.2

Via ya browser.. 4 clicks.... and the backup is on your HDD


DD
__________________
Old Dollars >>>> Now with over 90 Hosted Free Sites <<<<
DangerDave.com.au - Adult Links to Free Porn
DangerDave is offline   Reply With Quote
Old 2003-08-27, 12:05 PM   #8
iSC_Luke
Aw, Dad, you've done a lot of great things, but you're a very old man, and old people are useless
 
Join Date: Aug 2003
Location: T.O.
Posts: 23
Send a message via ICQ to iSC_Luke
Quote:
Originally posted by DangerDave
..and for those that are telnet/ssh/sql-challenged..

Get PhpMyAdmin - http://www.phpmyadmin.net/

backups are even simpler.

DD
PhpMyAdmin is a great software package, however I don't think there is anyway to set it up to do a cron job and export the stuff on a regular basis.

However if you need to just do a quick backup - it does the job well - you just need to remember to do it every so often.

If you have ssh or telnet access - Cleo's recommendation is more automated
__________________
<table width="100%" cellpadding="0" cellspacing="0"><tr><td width="100%"><a href="http://www.isharecash.com/refisc.php?a=i100"><img src="http://www.isharecash.com/promo/isharecash/banners/120x60_isc1.gif" border=0></a></td><td><img src="http://www.isharecash.com/G/sigs/bm.jpg" border=0"></td></tr></table><font face="Terminal" size=1 style="text-decoration:none">Weekly Payouts &nbsp;&copy;&nbsp; Top-Converting Niche Sites.</font>
iSC_Luke is offline   Reply With Quote
Old 2003-08-27, 12:08 PM   #9
Cleo
Subversive filth of the hedonistic decadent West
 
Cleo's Avatar
 
Join Date: Mar 2003
Location: Southeast Florida
Posts: 27,936
Using this page as a guide
http://www.cgi-interactive.co.uk/mysql_dump.html
I have daily backups of each of my databases.

It works like a charm and I don't have to remember to do anything.
__________________
Free Rides on Uber and Lyft
Uber Car: uberTzTerri
Lyft Car: TZ896289
Cleo is offline   Reply With Quote
Old 2003-08-27, 12:09 PM   #10
iSC_Luke
Aw, Dad, you've done a lot of great things, but you're a very old man, and old people are useless
 
Join Date: Aug 2003
Location: T.O.
Posts: 23
Send a message via ICQ to iSC_Luke
TIP: When you export the DB in phpMyAdmin, use this format for the file name: "__DB__ %Y-%m-%d" - it will format the file name like this: "dbname 2003-08-27" - or re-arrange it to fit your purpose

You can also use "__TABLE__" when only exporting 1 table.
__________________
<table width="100%" cellpadding="0" cellspacing="0"><tr><td width="100%"><a href="http://www.isharecash.com/refisc.php?a=i100"><img src="http://www.isharecash.com/promo/isharecash/banners/120x60_isc1.gif" border=0></a></td><td><img src="http://www.isharecash.com/G/sigs/bm.jpg" border=0"></td></tr></table><font face="Terminal" size=1 style="text-decoration:none">Weekly Payouts &nbsp;&copy;&nbsp; Top-Converting Niche Sites.</font>
iSC_Luke is offline   Reply With Quote
Old 2003-08-27, 01:08 PM   #11
johnbx
Internet! Is that thing still around?
 
Join Date: Aug 2003
Posts: 1
acually

acually i just have the cron job email me the file on a different machine that way i have it sitting in my box with a nice history if i choose to keep.

all you do is the mysqldump like this

mysqldump -u user -ppass db | gzip -9 | uuencode db_backup | mail -s"todays back up" you@mail.com
johnbx is offline   Reply With Quote
Old 2003-08-27, 01:13 PM   #12
Cleo
Subversive filth of the hedonistic decadent West
 
Cleo's Avatar
 
Join Date: Mar 2003
Location: Southeast Florida
Posts: 27,936
Re: acually

Quote:
Originally posted by johnbx
mysqldump -u user -ppass db | gzip -9 | uuencode db_backup | mail -s"todays back up" you@mail.com
That looks very simple and sweet, may have to give that a try next time I add in a database.
__________________
Free Rides on Uber and Lyft
Uber Car: uberTzTerri
Lyft Car: TZ896289
Cleo is offline   Reply With Quote
Old 2003-08-27, 06:40 PM   #13
DangerDave
Bonged
 
DangerDave's Avatar
 
Join Date: Mar 2003
Location: BrisVegas, AUSTRALIA
Posts: 4,882
All true...

My preamble - "..and for those that are telnet/ssh/sql-challenged.. "

DD
__________________
Old Dollars >>>> Now with over 90 Hosted Free Sites <<<<
DangerDave.com.au - Adult Links to Free Porn
DangerDave is offline   Reply With Quote
Old 2003-08-29, 12:05 AM   #14
EclectiXXX
Well you know boys, a nuclear reactor is a lot like women. You just have to read the manual and press the right button
 
EclectiXXX's Avatar
 
Join Date: Apr 2003
Location: Md USA
Posts: 159
Send a message via ICQ to EclectiXXX Send a message via AIM to EclectiXXX Send a message via Yahoo to EclectiXXX
Just an FYI Cleo's line of code works like a charm!!!

I'm still dinkin round with johnbx's code for CRON... We'll see if I can get it to run tonight...
EclectiXXX is offline   Reply With Quote
Old 2003-09-11, 12:52 PM   #15
AcidMaX
Programming till my fingers bleed.
 
AcidMaX's Avatar
 
Join Date: Aug 2003
Location: Michigan
Posts: 876
You could also just add a line to cron and backup your databases nightly, weekly whatever you want. You just have to remember to download them. Or you could get a quick script made in PERL or PHP that will email you the actual file tarred or gzipped on a nightly basis so there is nothing you have to do. Just sit there and check email in the morning :-)

Andy
AcidMaX is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 06:29 PM.


Mark Read
Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
© Greenguy Marketing Inc