Here's an easy way to backup your web site's files and database (worth thousands of dollars, no doubt) that costs $0 to learn and perform. It only takes seven easy steps.You don't need to know a lot about how to use Unix or how to use databases like mySQL. The only real tool you need is a telnet client. Also, you need to know a few commands which I'll show you now. (You could even write
commands I'm about to give you on a cheatsheet.)
STEP 1: CONNECT & GET IN THE RIGHT FOLDER
The web host you're trying to back up needs to allow shell access (most do these days).
If you have a Windows computer, download a program called "PuTTY" which you can use to login in your web host's shell. Search for "putty ssh" on Google or get it here: http:/ he.earth.li/~sgtatham/putty/latest/x86/putty.exe
Open up PuTTY and at
top type in your hostname (your web site address without
http or www, just "yourname.com"). Your web host either uses SSH or telnet, first try logging in using SSH and if it won't connect try it using Telnet. Click
"Open" button at
bottom to connect.
When it connects you will be asked for your account's username, and after you enter that, it will ask for your password. If these both take, you'll see a command prompt of sorts. What you have to do is browse to
document root, depending on your host it's usually a folder like "public_html" or "wwwroot".
If
wwwroot or public_html folder has more folders inside of it, in
form of yourdomain.com, don't browse into them yet, just stay in
folder you're in.
Browsing in
Unix command prompt is just like DOS, to view a folder type "dir" or "ls", and to go into a certain folder type "cd foldername". If you messed up you can type "cd .." to move up one level.
STEP 2: BACK-UP THE DATABASE
The first step if you're backing up a site is to dump your mySQL database. To do this obviously you need
mySQL username and password you want to back up. If your mySQL username is "myuser" and
mySQL password is "mypassword", you'd type:
mysqldump -umyuser -pmypassword -A > dump.sql
mysqldump is
program we run to dump
database into a file, then we type "-u" followed by
username (no spaces) and "-p" followed by
password (also no spaces). The uppercase "-A" tells
program we want to dump every database this user has access to. It MUST be an uppercase A.
The ">" afterwards says we want to put this program's output into a file (otherwise it would show up on
screen) and "dump.sql" is
name of
file we're going to dump to.
This may take a while depending on
size of your database. Be patient. Once you have a command prompt again, it's done.
If you don't have root on your server, it may show databases you don't have access to. What you'll have to do here is "force" mysqldump to keep doing
backups even if it gets error messages. The flag for "force" is "-f".
mysqldump -umyuser -pmypassword -Af > dump.sql
STEP 3: BACK-UP YOUR FILES
Now you can put everything into one big file, which you can easily move over to
new host in one go, instead of one at a time. Unix doesn't let you create Zip files, but you can create a TAR (Tape Archive) which just rolls a bunch of files together without any sort of compression.
To create your TAR archive, type:
tar -cvf dump.tar *