• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

Startup Hero

The Official Blog Of Name Hero

Learn To Fly Above The Competition Get Started
  • HomeWelcome
  • CoursesVideo Training Center
  • About UsWhat is StartupHero?
  • BlogGet the latest
  • Start HereStartup 101
  • SpeakingPodcast & Media
  • ResourcesTools to help You
    • Reselling WordPress Hosting
    • Resell Hero
    • How To Start A Blog
  • NameHeroCloud Web Hosting

How To Schedule And Download WordPress Database Backups

By Bhagwad Park on August 15, 2018 0

How To Schedule And Download WordPress Database Backups

In a previous article, I’d shown you how to connect to your MySQL WordPress database remotely through the HeidiSQL program. Now if you need to take a backup, it’s extremely easy. Just open your database in HeidiSQL, right-click the database you want and export as SQL. Problem solved!

However, this is purely a GUI interface. It needs a user to manually select the backup option. There’s no command line interface that we can use to schedule a task. So in this tutorial, I’ll show you how to schedule a backup of your database and download it onto your computer.

Why Not Just Use a Plugin?

Two reasons. First, a plugin will perform a backup and either store it on the local server or send it to a 3rd party online storage. If your local server crashes, you lose all your backups. In addition, you want to reduce the load on your WordPress installation as much as possible. This means minimizing cron jobs and reducing the number of plugins.

For these reasons, I prefer to schedule backups remotely and have them downloaded onto my local desktop.

Gathering the Requirements

To schedule a remote backup, we need the following pieces of information first:

  1. The full path to where you want the backup to be stored
  2. Your hostname or IP address
  3. Your database username
  4. Your database password
  5. Your database name

Step 1: Getting the Database Details and Enabling Remote Access

To connect to the database remotely, we need to follow the same initial steps as outlined in my earlier tutorial. Basically, open up your wp-config.php file and get the details. There are screenshots in the tutorial as well, so check it out!

The tutorial also includes instructions on how to enable remote access from cPanel.

Caveat: Due to PCI compliance requirements, you might need to use a different IP address for remote access. Read the instructions on the remote access screen in cPanel for further details.

Step 2: Downloading the mysqldump Utility

This is the standard tool for exporting MySQL databases from the command line. The mysqldump utility is part of the community server package from Oracle. Visit this page and scroll down to download the zip archive.

Download MySQL Community Server

There’s no need to get the debug binaries and test suite. The first one is sufficient. Once you’ve downloaded it, unzip the directories into a permanent location. I personally choose C:\ , but you can put it anywhere you want as long as you remember where it is. Once unzipped, navigate to the “bin” directory to find the “mysqldump.exe” file as shown here:

Location of mysqldump utility

Copy the full path to the file so we can reference it. One way to do this is to use the “where” utility in the Windows command line with the /R parameter indicating the directory to look in. For example:

where /R c:\ mysqldump

Shows this:

Use Where Command to get the Exact Path

I copy this address and keep it with me. Now we have all the ingredients to create the backup command.

Step 3: Creating the Backup Command

The template for the command is this:

[full path to mysqldump.exe] --column-statistics=0 --host [host or IP name] -u [username] -p[password] [database name] > [path to destination filename]

Note that there’s no gap between “-p” and your password!

Plug in all the necessary pieces of information. When you have your final command, open a command line and execute it like this:

Executing mysqldump Command

You’ll get a warning about using your password on the command line, but it can’t be helped. Can’t schedule a task without it! Once the command completes, verify that it works. The backup file should have been created like this:

MySQL Backup Has Been Created

Step 4: Scheduling the Task

Now that we have a working command, we can schedule it to run using the built-in OS task scheduler. On Windows, we can access it like this:

Task Scheduler

Once open, go to Action->Create Basic Task, and a wizard dialogue will open to guide you through the process. Choose the frequency and the time of execution. In the “Action” dialogue, choose “Start a program”, and then paste the entire command into the provided box.

You’ll get a popup asking you to confirm the parameters. Click ok to continue and your task will be scheduled as planned.

Congratulations! You’ve successfully scheduled a remote backup of your WordPress MySQL database onto your local PC!

Bhagwad Park Profile Picture
Bhagwad Park

I’m a NameHero team member, and an expert on WordPress and web hosting. I’ve been in this industry since 2008. I’ve also developed apps on Android and have written extensive tutorials on managing Linux servers. You can contact me on my website WP-Tweaks.com!

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

Connect With Us!

Superhero Resources

Fix Common Issues

  • How To Setup Free And Automatic SSL Certificates
  • How To Setup Cloudflare With Railgun
  • How To Fix Memory Exhausted Errors In WordPress
  • How To Edit PHP Version/Upload Limit/Add Extensions
  • How To Move/Migrate Your Business To Name Hero

Free Guides

  • How To Setup NameHero Hosting
  • How To Create A Web Hosting Business With WordPress
  • How To Start A WordPress Blog
  • How To Migrate WordPress To A VPS
  • How To Speed Test And Optimize Your WordPress Website
  • Magento 2.X Installation Guide
  • How To Clean Up A WordPress Hack

Training

Recent Posts

  • The Best WordPress Plugin To Combat Plagiarism
  • Is It Time to Bring Back Blog Comments?
  • Two Filters That No Longer Work In Gutenberg (And Workarounds)
  • Migrating To The New Cloudflare Managed Rules Interface
  • How To Sort Posts By The “Last Modified” Date
  • How To Make WordPress Send E-mail From Another Address
Subscribe in a reader
  • Web Hosting
  • WordPress Hosting
  • Reseller Hosting
  • VPS Hosting
  • Twitter
  • Facebook
  • LinkedIn
  • YouTube
  • FTC Disclosure
  • Earnings Disclosure
  • Privacy Policy

Copyright © 2023 · Smart Passive Income Pro on Genesis Framework · WordPress · Log in