Feb 2, 2016

Magento How to take database and code backup using SSH command line excluding var and media folder

1. Backup Database 

Command::> mysqldump -uUsername -pPassword DBName > /var/www/projectFolderName/www/var/sqlfilename.sql

Hint:
Username - Your database user name
Password - Your database Password
DBName - Your database name
sqlfilename.sql - Database backup file name. It can be anything.
/var/www/projectFolderName/www/var/sqlfilename.sql - This is path of your server where it will be downloaded



2. Code Backup

Command::> First Go To The Root Of Your Project then execute below command
Command::> tar -czvf codebackupfilename.tar.gz www --exclude='www/media' --exclude='www/var'

Hint:
codebackupfilename.tar.gz - Code backup file name. It can be anything.
--exclude='www/media' - To exclude media folder from backup (If you want media folder then remove this line)
--exclude='www/var' - To exclude var folder from backup (If you want var folder then remove this line)

No comments:

Post a Comment