Recently we updated viralpatel.net and moved to WordPress 2.8.4. The process of upgrading the wordpress went smooth. The wordpress installation you are running your website on must be updated regularly to avoid any kind of security threats in older versions of wordpress.
But while you play with your stable website code, it is always advisable to take backup of your website. The web hosting companies often take backup of the website hosted on their servers, but it is good to keep the backup locally.
Let us see different ways of taking Backup of a website.
A webmaster should often take the code backup of website to avoid any accidental loss of code. Also before every major/minor update in website, the backup of the code should be kept at a safe place. Following are few simple methods of taking website dumps or backup of code.
cPanel provides wide variety of useful features to take backups of websites. One of such feature is Backup Wizard.
Goto cPanel -> Files -> Backup Wizard
You can take backup of the code, database, email filter configuration etc using this wizard.
FTP can be used to take backup of your website code. Lot of FTP clients are available which can be used to connect to a website using FTP and take the backup. My favorites are FileZilla and FireFTP (FireFTP is the popular Firefox extension).
PHPMyAdmin is a great MySQL frontend client which is already installed with cPanel. PHPMyAdmin can be used to take database backups directly.
Select PHPMyAdmin from your cPanel and select all the tables that you need to take backup of. Then click on Export and save the exported file in your machine. Database backup should be taken before any of the major updates in the website.
If you are using WordPress as your website CMS/Blogging software, you may want to take advantage of WP-DBManager, a cool wordpress plugin that take cares of the database backup.
WP-DBManager provides a number of options including optimize database, repair database, backup database, restore database, delete backup database , drop/empty tables and run selected queries. It also supports automatic scheduling of backing up and optimizing of database.
Cron Jobs are great way of scheduling daily task in your Webhosting space which can be configured to run at particular interval of time. You may want to schedule a Cron Job which automatically takes database backup on daily basis.
Here is a DB backup script that can be used for daily automatic DB backups. This script can backup multiple DBs at the same time. The script below is set to backup 2 DBs. If you want to backup more just copy and paste the bottom section and change info to match that DB. If you just want to backup just 1 DB then delete the second section of the bottom section of the script.The functions of the script are commented in the script.
Here are the steps to configure the automatic backup.
#============================================== #Save the script below as db_dump.txt #============================================== #!/bin/bash # Script Created by Fernis # Last edited 8/25/07 by Fernis # Script Function: # This bash script backups up the "DBname" and "DBname" db everyday at 4am with a file name time stamp and tar.gz zips the file. # The "DBname" db will be saved in /backups/database_backups/"DBname"/ # The "DBname" db will be stored in /backups/database_backups/"DBname"/ # Db backups older than 30 days will be deleted. #[Changes Directory] cd /home/"accountname"/backups/ #[Old DB Deletion Script] find /home/"accountname"/backups/database_backups -name "*.tar.gz" -mtime +30 -exec rm -f {} \; #[Stamps the file name with a date] TIMESTAMP=`date +%m-%d-%y-%H%M` #[DB Backup Scripts] # "DBname" HOST=localhost DBNAME="DBname" USER="DBusername" PASSWORD="DBpassword" DUMP_PATH=/home/"accountname"/backups/database_backups/"DBname" mysqldump --opt -c -e -Q -h$HOST -u$USER -p$PASSWORD $DBNAME > $DBNAME.sql tar czpf $DUMP_PATH/$DBNAME.$TIMESTAMP.tar.gz $DBNAME.sql rm -f $DBNAME.sql # "DBname" HOST=localhost DBNAME="DBname" USER="DBusername" PASSWORD="DBpassword" DUMP_PATH=/home/"accountname"/backups/database_backups/"DBname" mysqldump --opt -c -e -Q -h$HOST -u$USER -p$PASSWORD $DBNAME > $DBNAME.sql tar czpf $DUMP_PATH/$DBNAME.$TIMESTAMP.tar.gz $DBNAME.sql rm -f $DBNAME.sql #======================================= #END OF BACKUP SCRIPT #=======================================
Java URL Encoder/Decoder Example - In this tutorial we will see how to URL encode/decode…
Show Multiple Examples in OpenAPI - OpenAPI (aka Swagger) Specifications has become a defecto standard…
Local WordPress using Docker - Running a local WordPress development environment is crucial for testing…
1. JWT Token Overview JSON Web Token (JWT) is an open standard defines a compact…
GraphQL Subscription provides a great way of building real-time API. In this tutorial we will…
1. Overview Spring Boot Webflux DynamoDB Integration tests - In this tutorial we will see…
View Comments
Thanks, some neat information!
THANKS FOR GREAT ARTICLES.
thank you very much for this tutorial.. its very good one.
Thanks Viral. Simple and clean.
Really nice tutor.