Backup and Restore
tar cfz backup.tar.gz ./* #this will backup all files in the current directory – it will create the archive ready to restore in the directory as well (It will not created nested folders starting from root).
To restore a backup use the following command:
tar xfz backup.tar.gz
mysqldump -hHOST -uUSERNAME -pPASSWORD DATABASENAME > BACKUPFILE.sql #this will backup a mysql database.
; \ <– This can be used at the end of every line so that if you paste multiple lines into Shell, it will execute them all.
To restore an sql database, use the following command:
mysql -h HOSTNAME -u USERNAME -pPASSWORD DATABASE < FILE.sql
Advertisement