Title: Throwing error
Last modified: June 15, 2022

---

# Throwing error

 *  Resolved [songsofabba](https://wordpress.org/support/users/songsofabba/)
 * (@songsofabba)
 * [3 years, 10 months ago](https://wordpress.org/support/topic/throwing-error-4/)
 * Hello and thanks for this great plugin! Since a couple of updates ago my error
   log was filled with the same error for the 3 sites where i’m using this plugin
   like this.
 *     ```
       [23-Apr-2022 09:01:47 UTC] WordPress database error for Table 'xxx_aiowps_debug_log' already exists förfrågan CREATE TABLE xxx_aiowps_debug_log (
       			id bigint(20) NOT NULL AUTO_INCREMENT,
       			level varchar(25) NOT NULL DEFAULT '',
       			message text NOT NULL DEFAULT '',
       			type varchar(25) NOT NULL DEFAULT '',
       			created datetime NOT NULL DEFAULT '1000-10-10 10:00:00',
       			PRIMARY KEY  (id)
       			)DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci;
       ```
   
 * I have googled around to find a solution and it seems that i manage to get rid
   of this error by changing in the wp-securtity-debug-logger.php file from “CREATE
   TABLE” to “CREATE TABLE IF NOT EXISTS” in this section.
 *     ```
       //This exists as a constant, but multisite will need to refresh $wpdb->prefix
       		$debug_log_tbl_name = $wpdb->prefix.'aiowps_debug_log';
   
       		$debug_log_tbl_sql = "CREATE TABLE IF NOT EXISTS " . $debug_log_tbl_name . " (
       			id bigint(20) NOT NULL AUTO_INCREMENT,
       			level varchar(25) NOT NULL DEFAULT '',
       			message text NOT NULL DEFAULT '',
       			type varchar(25) NOT NULL DEFAULT '',
       			created datetime NOT NULL DEFAULT '1000-10-10 10:00:00',
       			PRIMARY KEY  (id)
       			)" . $charset_collate . ";";
   
       		maybe_create_table($debug_log_tbl_name, $debug_log_tbl_sql);
   
       	}
       ```
   
 * Is this a correct solution? In that case do you consider change this in coming
   update?
    Thank you again for this great plugin! Best regards Lennart

Viewing 1 replies (of 1 total)

 *  Plugin Support [vupdraft](https://wordpress.org/support/users/vupdraft/)
 * (@vupdraft)
 * [3 years, 10 months ago](https://wordpress.org/support/topic/throwing-error-4/#post-15741116)
 * I was unable to replicate this on my site and we have not had any other reports
   of this yet.
 * I believe AIOWPS uses WordPress core dbDelta() function for creating/altering
   database tables. If a table already exists the create table_name SQL statement
   is normally ignored by dbDelta().
 * Only when a Describe table_name; SQL statement returns nothing (MySQL errors 
   are suppressed), dbDelta() will attempt to create the table.
 * Thus, it is likely the you are running into a MySQL privilege issue.
    However,
   I don’t see any issues with the solution that you have implemented.

Viewing 1 replies (of 1 total)

The topic ‘Throwing error’ is closed to new replies.

 * ![](https://ps.w.org/all-in-one-wp-security-and-firewall/assets/icon-256x256.
   png?rev=2798307)
 * [All-In-One Security (AIOS) – Security and Firewall](https://wordpress.org/plugins/all-in-one-wp-security-and-firewall/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/all-in-one-wp-security-and-firewall/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/all-in-one-wp-security-and-firewall/)
 * [Active Topics](https://wordpress.org/support/plugin/all-in-one-wp-security-and-firewall/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/all-in-one-wp-security-and-firewall/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/all-in-one-wp-security-and-firewall/reviews/)

## Tags

 * [Database Error](https://wordpress.org/support/topic-tag/database-error/)

 * 1 reply
 * 2 participants
 * Last reply from: [vupdraft](https://wordpress.org/support/users/vupdraft/)
 * Last activity: [3 years, 10 months ago](https://wordpress.org/support/topic/throwing-error-4/#post-15741116)
 * Status: resolved