Aug 132014
 

All In One WP Security And Firewall Database Security helps you setup the database security, change db prefix, create database backups and more.

Last Updated: December 1, 2019

Latest News: Updated the documentation.

It is very important to create a database backup of your site. AIOWPS has the feature needed for this. Once you install AIOWPS plugin, the first step you need to take is to create a database backup. Anything goes wrong from here on and at least you will be protected and you will be able to restore your site through the database you create in this step.

Note: Make sure you follow these steps carefully.

 What you need:

All In One WP Security And Firewall Database Security

Step 1 ) Go to WP Security -> Database Security admin tab as illustrated in the image below.

aiowps-database-security-admin-menu

Step 2 ) The following image Database Security allows you to mange the following settings.

Database Security Settings

  • DB Prefix
  • DB Backup

all-in-one-wp-security-and-firewall-database-security

DB Prefix

Step 3 ) Go to WP Security -> Database Security -> DB Prefix  to set up the following.

Enabling this feature will give you another  10 points score towards your security meter. See images below. (Intermediate Security Level)

DB Prefix Settings

  • Current DB Table Prefix:
  • Generate New DB Table Prefix:

Information: There is another tab Host System Logs which displays the host log files. This can be very handy to check from time to time especially when you are trying to troubleshoot a problem. 

all-in-one-wp-security-db-prefix

DB Backup

Step 4 ) Go to WP Security -> Database Security -> DB Backup to set up the following. You can create a Manual Backup or set up Automated Scheduled Backups.

Enabling this feature will give you another  20 points score towards your security meter. See images below. (Basic Security Level)

DB Backups Settings

  • Click on Create DB Backup Now button to create a manual database.
  • Enable Automated Scheduled Backups:
  • Backup Time Interval:
  • Number of Backup Files To Keep:
  • Send Backup File Via Email:

all-in-one-wp-security-backup

Note: If the emailed attachment always turns up as an SQL file and not a ZIP file like all the others that means that your server is not configured correctly.

(The following was quoted by Chesio in the forum)

Database backup files are zipped only if there is ZIP extension enabled in PHP, so if you are getting plain sql files by email, most likely that website has this extension disabled.

You can find whether this extension is enabled in output of phpinfo or you can create a dummy PHP file with class_exists( 'ZipArchive' ) check – this is what actually AIOWPSF plugin does.

For example:

<?php
echo class_exists( 'ZipArchive' ) ? 'ZIP extension seems enabled' : 'ZIP extension seems disabled';

Troubleshooting Backups

Q1 ) I have created scheduled backups, but they don’t run consecutively on a daily basis as per my setup.  I don’t understand how backup works using WordPress wp-cron functionality.

Explanation: How the scheduled backup feature works with WordPress wp-cron functionality.

The backup time is set at the time you save the automatic scheduled backup settings. In order for the backup to trigger around the time you expect it to, you will need some kind of site activity (such as someone visiting) just after that time.

For example:

If I’ve just configured my scheduled backup settings to do a once daily backup and saved the config now and it is currently 7:11pm at my location, then the wp-cron will be scheduled to perform a backup at around 7:11pm everyday. Which means that the next backup will be scheduled for tomorrow at approximately 7:11pm – BUT – as mentioned in my last response, if nobody visits my site till 10:30pm tomorrow, then no backup will occur at 7:11pm because there was no activity on the site just after 7:11pm to trigger the wp-cron event. What will happen is that the system will immediately trigger a backup as soon as someone visits my site anytime after the scheduled time. (In other words in this example the backup will occur at 10:30pm)

On the next day the same thing applies…..the aiowps backup is still scheduled for around 7:11pm and if I get my next visitor at 7:12pm then the backup will be performed at 7:12pm.

I hope this example makes it a bit clearer. ( Explanation provided by wpsolutions)

Backup Tests:

by going to:
1) Enable debug, go to WP Security -> Settings -> Enable Debug (The log files can help you troubleshoot backup issues.)

2) Set “Number of Backup Files To Keep” to 5.
Do 5 separate manual backups. Check the backups directory and verify that there are 5 backups.

3) Set “Number of Backup Files To Keep” to 3.
Do 2 more separate manual backups. Check the backups directory and verify that there are 3 backups only. (2 oldest backups from previously should have been deleted)

4) Set backup time interval to 1 hour.
Over a period of a day check the backup directory and verify that the number of backups is always as per the config.
(Also check the “wp-security-log-cron-job.txt” file to verify that the logs show that backups were done)

==================================

Q2 ) If you receive the following error when you try to create a backup. Try one of the solutions below.

“PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 72879700 bytes) in /var/www/html/wp-content/plugins/all-in-one-wp-security-and-firewall/classes/wp-security-backup.php on line 67”

It could be related to the backup directory not being created correctly in your server when you try to create a backup. It could also mean that you need to allocate more memory to your WordPress.

Solution 1: Make sure that the following path exist in your server /yourwebsite/wp-content/aiowps_backups/. With the proper folder permissions 0755.

Solution 2: Adding the following define( 'WP_MAX_MEMORY_LIMIT', '384M' ); to wp-config.php file can also help.

Hint: Remember to make sure you have 384M allocated to your WordPress if not adjust this in accordance to what has being allocated to your WordPress. Which could be 96M, 128M, 256M.

=============================

FAQ

Q1 ) How do I restore my database from the backup file?

Solution: Click the following link how-to-take-a-database-backup-using-the-all-in-one-wp-security-plugin to learn more.

=============================

I hope the above steps helps you manage your database. 

Click on the following link Filesystem Security to continue configuring the plugins settings.

If you have any questions please let me know

Enjoy.

All In One WP Security & Firewall Plugin Tutorial List

Manuel Ballesta Ruiz is a web developer, Blogger and WordPress Enthusiast.

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)