• Home
  • Archive
  • Tools
  • Contact Us

The Customize Windows

Technology Journal

  • Cloud Computing
  • Computer
  • Digital Photography
  • Windows 7
  • Archive
  • Cloud Computing
  • Virtualization
  • Computer and Internet
  • Digital Photography
  • Android
  • Sysadmin
  • Electronics
  • Big Data
  • Virtualization
  • Downloads
  • Web Development
  • Apple
  • Android
Advertisement
You are here:Home » How to Backup WordPress Site Manually via SSH

By Abhishek Ghosh September 8, 2022 6:07 pm Updated on May 14, 2023

How to Backup WordPress Site Manually via SSH

Advertisement

If you are running a WordPress website on a cloud server or a VPS, then you may need to take manual backups for various reasons. While this article is not the fastest to read the guide reading this guide will help you to manage your server without requiring you to install any web hosting panel or PHPMyadmin. Before taking a backup, you should look at your MySQL database size. If the size of database is too huge then you may read our this guide.

As we know, WordPress has two things to take a backup of – the first is the FTP files and the second is the MySQL database. Another thing you may take backup of is the SSL certificates. I will assume that :

  • If you are using a Windows PC then you have configured Ubuntu Bash for Windows, so you’ll use Ubuntu Bash to SSH.
  • If you are using a Mac, then you are using iTerm2.
  • If you are using a Linux PC, then you are using the default terminal app of your OS.

You already have one server’s WordPress (which you’ll take backup) with a domain name. Another server is required to take the backup (backup server). There are server backup server providers available these days, you can use our favourite VPSDime. VPSDime does not cost a huge per month and the staffs are knowledgeable about managing Linux servers. In case you got confused with something around a server, you can even pay them to do the job for you. If you are already using VPSDime to host your site, then use some other web hosting for backup. The backup server and main server should not be in the same data center (to minimize the chance of exploit, downtime etc).

Advertisement

---

 

Steps to Backup WordPress MySQL Database

 

Navigate to the root of the public directory of the main server, usually, we setup WordPress at /var/www/html :

Vim
1
2
3
4
cd /var/www/html
ls -al
locate wp-config.php
cat wp-config.php

You’ll get the MySQL database user name and password from wp-config.php file. You can example the MySQL database:

Vim
1
2
3
4
mysqldump -u <username> -p
# example
# mysqldump -u root -p
show databases;

It will show something like the below:

Vim
1
2
3
4
5
6
7
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| your-database      |
+--------------------+

You can check the tables:

Vim
1
show tables;

You can exit the MySQL interface by typing:

Vim
1
exit;

You can take a backup of the MySQL database by typing:

Vim
1
mysqldump -u username -p databasename > backup.sql

As it is a manual backup, you can restore this backup to test. You can restore to MySQL server by typing:

Vim
1
2
3
4
show databases;
USE yourdatabasename;
mysql> \. backup.sql
show tables;

You can change the database name on wp-config.php file to check whether the backup is working. It is a robust, foolproof method, although it consumes some time. You can drop any of the databases you want:

Vim
1
mysql> DROP DATABASE backup;

Now, from the backup server, you can wget the SQL backup:

Vim
1
2
3
cd /var/www/
mkdir backup && cd backup
wget https://example.com/backup.sql

DO NOT forget to delete the SQL backup from the main server :

Vim
1
2
cd /var/www/html
rm backup.sql

But doing the above via SSH every day is not practical for most webmasters. Consider automating by using a bash script or using MySQL Workbench.

How to Backup WordPress Site Manually via SSH

 

Steps to Backup WordPress FTP

 

As the size of FTP files is often large, we need to check the space available on the server and the size of the FTP files.

Vim
1
2
3
4
5
6
# go to the root of FTP
cd /var/www/html
# check the space available on the whole server
df -h
# check the size of the FTP files
du -h /var/www/html

Now make a tarball of the whole FTP :

Vim
1
2
# go to the root of FTP
tar -vcf mybackup.tar.gz .

Now from your backup server, wget the tarball:

Vim
1
2
cd /var/www/backup
wget https://example.com/mybackup.tar.gz

Although it is rarely required (unless you want to move the server), you can untar by running:

Vim
1
2
file mybackup.tar.gz
tar xvf mybackup.tar.gz

Again, you can automate this process by using a bash script or you can integrate GitHub with your instance.

 

Conclusion

 

Taking regular backup is of utmost importance. I will suggest you frequently download the backups on your local computer too and maybe, you can write them on an optical drive, SD card etc. A backup server makes the process fast but having a backup in “hand” gives a feeling of mental peace.

Although this article is bigger to read, this will extremely help you in case you want to migrate from one server to another.

Facebook Twitter Pinterest

Abhishek Ghosh

About Abhishek Ghosh

Abhishek Ghosh is a Businessman, Surgeon, Author and Blogger. You can keep touch with him on Twitter - @AbhishekCTRL.

Here’s what we’ve got for you which might like :

Articles Related to How to Backup WordPress Site Manually via SSH

  • Nginx WordPress Installation Guide (All Steps)

    This is a Full Nginx WordPress Installation Guide With All the Steps, Including Some Optimization and Setup Which is Compatible With WordPress DOT ORG Example Settings For Nginx.

  • WordPress & PHP : Different AdSense Units on Mobile Devices

    Here is How To Serve Different AdSense Units on Mobile Devices on WordPress With PHP. WordPress Has Function Which Can Be Used In Free Way.

  • WordPress Multisite on Nginx on Ubuntu 14.04 on HP Cloud

    Here is a Step by Step Guide on Setting Up WordPress Multisite on Nginx on Ubuntu 14.04 on HP Cloud with All Commands and the Configuration.

  • How to Install WordPress : Ubuntu 16.04, Nginx, PHP7-FPM

    Here is Step by Step Guide on How to Install WordPress on Ubuntu 16.04, Nginx, PHP7-FPM, memcached & Percona MySQL 5.7 on Cloud Server or VPS.

performing a search on this website can help you. Also, we have YouTube Videos.

Take The Conversation Further ...

We'd love to know your thoughts on this article.
Meet the Author over on Twitter to join the conversation right now!

If you want to Advertise on our Article or want a Sponsored Article, you are invited to Contact us.

Contact Us

Subscribe To Our Free Newsletter

Get new posts by email:

Please Confirm the Subscription When Approval Email Will Arrive in Your Email Inbox as Second Step.

Search this website…

 

Popular Articles

Our Homepage is best place to find popular articles!

Here Are Some Good to Read Articles :

  • Cloud Computing Service Models
  • What is Cloud Computing?
  • Cloud Computing and Social Networks in Mobile Space
  • ARM Processor Architecture
  • What Camera Mode to Choose
  • Indispensable MySQL queries for custom fields in WordPress
  • Windows 7 Speech Recognition Scripting Related Tutorials

Social Networks

  • Pinterest (24.3K Followers)
  • Twitter (5.8k Followers)
  • Facebook (5.7k Followers)
  • LinkedIn (3.7k Followers)
  • YouTube (1.3k Followers)
  • GitHub (Repository)
  • GitHub (Gists)
Looking to publish sponsored article on our website?

Contact us

Recent Posts

  • Hybrid Multi-Cloud Environments Are Becoming UbiquitousJuly 12, 2023
  • Data Protection on the InternetJuly 12, 2023
  • Basics of BJT TransistorJuly 11, 2023
  • What is Confidential Computing?July 11, 2023
  • How a MOSFET WorksJuly 10, 2023
PC users can consult Corrine Chorney for Security.

Want to know more about us?

Read Notability and Mentions & Our Setup.

Copyright © 2023 - The Customize Windows | dESIGNed by The Customize Windows

Copyright  · Privacy Policy  · Advertising Policy  · Terms of Service  · Refund Policy