Monthly Archives: June 2009

Don’t upgrade yet!

I know how tempting it is to press that upgrade button, but don’t do it without backing up those files. Backing up your files first is just too quick and easy to skip when doing it from the command line. Here’s how:

Backup your MySQL database
DATE=`date | tr ” ” _`
mysqldump -u root -p DatabaseName > DatabaseName.$DATE.sql

Backup your web directory
tar cvzf new_filename.tar.gz /var/www/

c = create
v = verbose
z = compress
f = filename is being provided

If you need to restore these files

Restore MySQL database
mysql -u root -p DatabaseName < DatabaseName.Thu_Jun_11_08:14:41_CDT_2009.sql

Restore the web directory

cd /var/www/ (change directory to the location of the web directory)

mv httpdocs httpdocs_bad (rename the current web directory)

tar -xzvf httpdocs.tar.gz (uncompress the backup)