Thursday, June 13, 2019

How to Backup Website using Command Line and Download to your Computer

To backup website web source and database using Command Line



1. MySQL Back up website database

·       
  • To verify what database name is used in the website, check website’s wp-config.php
  • Once website database name is verified in wp-config.php;  Verify it in mysql ; Once verified.
  • Run command to back up database, don’t worry it won’t affect current database, this will only create a copy.


            # mysqldump –u root –p database_name > backUpDatabaseNameDate.sql

            e.g:  # mysqldump –u root –p database_name > mysqldump_db_backup_WebsiteDatabase_name20190314.sql

2. Back up website web source

  •          Locate folder that contains WordPress files.
  •          Verify if you’re in the folder where you can see the folder that holds WordPress files.


            # tar -zcvf newWebNameBackUpDate.tar.gz  folderName
            e.g:  # tar -zcvf web_castleoaklp_20140418.tar.gz  web_castleoaklp
           
  • Verify that backup tar websource and backup mysqdump is stored at website folder websource (e.g public_html)
  • Create "wgetdown" folder to store your downloads using wget command. Inside wgetdown folder, run command.


            wgetdown] # wget http://test.example.com/fileBackUp2019611.tar.gz

No comments:

Post a Comment