[Magento2] Important ! How to backup and restore ( CLI Command )

0
471

1. Backup Magento 

1) Files Backup : tar zcvf Filename.tar.gz PATH (  ex, tar zcvf babo-bak-20160710.tar.gz * )

2) DB Backup : mysqldump -uDBUSER -p DBNAME > Filename.sql ( ex, mysqldump -ubabo -p babo > babo-bak-20160710.sql )


2. Database Restore

– Remove Database : drop database DBNAME ;

– Create Database : create database DBNAME ;

– Database Restore : mysql -uDBUSER -p DBNAME < Filename.sql ( ex, mysql -ubabo -p babo < babo-bak-20160710.sql )


3. Magento File Restore

1) Delete Files

sudo rm -rf *

2) Extract Backup file

tar zxvf Filename.tar.gz ( es. tar zxvf babo-bak-20160710.tar.gz )

3) Change Files and Folder Permission

sudo chown -R Filemanager:Webmanager * ( ex, sudo chown -R root:www-data * )

find . -type d -exec chmod 770 {} \; && find . -type f -exec chmod 660 {} \; && chmod u+x ./bin/magento


LEAVE A REPLY

Please enter your comment!
Please enter your name here