🔥 Holiday Sale! 25% Off Platinum Membership $399.99 $299.99 (ends December 31).

Automatic WordPress backup to Google Drive

I regularly backup my WordPress files and the MySQL database on my internal network. While this is safe, what about emergencies where I lose my server and my backup drive? This though drove me to come up with a online WordPress backup solution. One of the first online storage service that struck my mind was Google Drive, which offer 5 GB of free storage. This is plenty for my applications. In this post, I explain how to setup automatic WordPress backup to Google Drive.

Before we begin, create a Google Drive Account. If you already have a google account, then just visit http://google.com/drive and click "Try Google Drive".

Wordpress Backup To Google Drive
Try Google Drive

Step 1: Install Google Drive for WordPress Plugin

The Google Drive for WordPress plugin can make backups of your WordPress files and Mysql DB to Google Drive. Backups are 'zip' archives created locally and uploaded to a folder of your choosing on Google Drive.

Google Drive For Wordpress
Google Drive For Wordpress

Step 2: Configure Google Drive for WordPress Plugin

Activate the plugin. Then go to "Configure Google" option from your dashboard to see the following settings page:

Wp Google Drive Menu
Wp Google Drive Menu

There are few things from this page you will have to use. So keep this window open and proceed to next next step.

Step 3: Signup for Google API Console and Create a Client ID and Secret

The Client ID and Secret allows applications to access your Google account and services. Visit Google API Console. If this is your first time visiting Google API Console, you may have to "Accept" the Terms of Service to proceed further. If you have not already created a project, you will have to create one. All you have to do is click on "Create Project".

Google Apis - Create Project
Google Apis - Create Project

After creating a project you will have to create a OAuth Client ID. All you have to do is click the "Create OAuth 2.0 client ID" button.

Create An Oauth Client Id
Create An Oauth Client Id

In the window that opens up, provide the branding information. Optionally, you may also provide the URL to your logo. Click "Next".

Client Id Branding Information
Client Id Branding Information

Choose "Web Application". Then choose "http://" and enter the domain name of your WordPress site. Then click "Create client ID".

Create Client Id - Settings
Create Client Id - Settings

 

Your created client ID will look something like this:

Google Api Client Id For Web Applications
Google Api Client Id For Web Applications

For the client ID that you just created under "Client ID for Web Applications", click "Edit Settings".

Edit Client Id Settings
Edit Client Id Settings

Then, go back to the window that you left open in Step 2. Copy the "redirecting url" highlighted in the image below.

Configure Google Account
Configure Google Account

Now go back to the "Edit Client ID Settings" window. Under "Authorized Redirect URLs", replace the existing URL with the one you copied in previous step.

Google Client Id - Settings
Google Client Id - Settings

Click on "Update". You are now done with setting up a Client ID and Secret. Leave this window open as you will have to copy the Client ID and Secret.

Step 4: Configure Google Drive for WordPress

Go back to "Configure Google" window and enter your API credentials copied from previous step.

Google Drive Api Credentials
Google Drive Api Credentials

Click on "Allow Access". You may have to login in (if you are not already logged in) and allow your site to access your Google Drive.

Google Api Allow Access
Google Api Allow Access

Once the authentication and connection are complete, you will be returned to your "Configure Google" dashboard page and will see "Configuration Successful". In future, if you have to reconfigure the backup to a different account, you may do so from this page.

Google Drive Configuration Successful
Google Drive Configuration Successful

Then in the "Backup Settings" section you may choose the folders you want to backup, whether or not to backup MySQL database, and finally the backup schedule.

Google Drive Backup Settings
Google Drive Backup Settings

Save the settings and you are done. If you would like to backup now then click the "Backup" link under "Configure Google". Backups are created with the unix timestamp in the file name. The example image below shows a zip archive that was created on Wed, 04 Jul 2012 at 13:52:16 GMT.

Wordpress Backup In Google Drive
Wordpress Backup In Google Drive

Troubleshooting

If you have a Cache plugin or a CDN running (e.g. CloudFlare) you have to disable/pause those temporarily until Google API access is configured successfully. If you choose to reconfigure but decide to use the same google account, then you will have to create a new Client ID and Secret (old one will not work).

Thats it! Setup automatic WordPress backup to Google Drive and enjoy the peace of mind.

Be the 1 in 200,000. Help us sustain what we do.
124 / 150 by Dec 31, 2024
You will gain benefits such as Deployarr access, discord roles, exclusive content, ad-free browsing, and more.
🔥 Holiday Sale! 25% Off Platinum Membership $399.99 $299.99 (ends December 31).
Join the Geek Army (starting from just $1.67/month)

Anand

Anand is a self-learned computer enthusiast, hopeless tinkerer (if it ain't broke, fix it), a part-time blogger, and a Scientist during the day. He has been blogging since 2010 on Linux, Ubuntu, Home/Media/File Servers, Smart Home Automation, and related HOW-TOs.

Holiday Sale