Abhishek Verma
w3Abhishek Notes

w3Abhishek Notes

Easy Peasy Guide: Backup WordPress Site in SSH

Easy Peasy Guide: Backup WordPress Site in SSH

Backup your WordPress blog or website hassle-free.

Abhishek Verma's photo
Abhishek Verma
·Apr 15, 2022·

2 min read

Hey WordPress webmasters,

In this article, I am sharing the easy peasy guide to backup your WordPress website with SSH. If you're hosting your website with any Cloud Hosting(Digital Ocean, Vultr, Google Cloud, etc) and have SSH access to your server, then this is the guide for you. You can use my methods to quickly backup your website and restore it quickly.

Follow the steps given below carefully to backup your WordPress website in the simplest and safest way possible.

  1. Login to your server with SSH
  2. Navigate to the website folder `/var/www/yourwebsite' in most cases
  3. View the wp-config.php file with cat command like cat wp-config.php if required use sudo permission sudo cat wp-config.php
  4. Note down the username, password, and database name from the wp-config.php file
  5. Copy-paste the following line with the required changes

    sudo mysqldump -u USER -pPASSWORD DATABASENAME > mydb.sql
    

    Note: You need to replace USER with username, PASSWORD with password, and DATABASENAME with the database name taken from the wp-config.php file. It will dump your website database in mydb.sql file. There will be no space between “p” andPASSWORD.

  6. Now archive all website files with the following command including the database file.

    sudo zip mywebsite.zip *
    
  7. Go to yourwebsite.com/mywebsite.zip to download your backup.

That's it your complete website is backed up. You can restore the website easily on any server.

Peace out!

 
Share this