• 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 September 8, 2022

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
mysql> \. backup.sql

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
tar -xzvf 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.

This Article Has Been Shared 477 Times!

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

  • 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.

  • Accessing Bluemix MySQL Database From External Server

    Here is How You’ll Be Accessing Bluemix MySQL Database From External Server With Root Access. On CLI You Need MySQL Client to Work on MySQL.

  • Ubuntu Server 18.04 WordPress Installation Bash Script (Beta)

    Here is Ubuntu Server 18.04 WordPress Installation Bash Script As Beta Version. We Are Using Percona MySQL, Ondrej’s PHP, Ondrej’s Apache2.

  • Install Jupyter Notebook and TensorFlow On Ubuntu 18.04 Server

    Here is How To Install Jupyter Notebook and TensorFlow On Ubuntu 18.04 Server. It is probably easy to install Anaconda for Python packages.

  • Why MySQL Auto Restart Failing in WordPress Cloud Server

    Why MySQL Auto Restart Failing in WordPress Cloud Server Despite Your Efforts of Trying Various Optimization and Scripts to Auto-Restart?

Additionally, 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

  • What is Voice User Interface (VUI) January 31, 2023
  • Proxy Server: Design Pattern in Programming January 30, 2023
  • Cyberpunk Aesthetics: What’s in it Special January 27, 2023
  • How to Do Electrical Layout Plan for Adding Smart Switches January 26, 2023
  • What is a Data Mesh? January 25, 2023

About This Article

Cite this article as: Abhishek Ghosh, "How to Backup WordPress Site Manually via SSH," in The Customize Windows, September 8, 2022, January 31, 2023, https://thecustomizewindows.com/2022/09/how-to-backup-wordpress-site-manually-via-ssh/.

Source:The Customize Windows, JiMA.in

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

We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept”, you consent to the use of ALL the cookies.
Do not sell my personal information.
Cookie SettingsAccept
Manage consent

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
CookieDurationDescription
cookielawinfo-checkbox-analytics11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional11 monthsThe cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy11 monthsThe cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
Functional
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytics
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Advertisement
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.
Others
Other uncategorized cookies are those that are being analyzed and have not been classified into a category as yet.
SAVE & ACCEPT