WordPress database error Specified key was too long
-
Hi
I’m using this plugin on several websites and have managed to successfully implement a CSP on each. Thanks for a great plugin that really fills a gap in the WP security model.
However, I get the this error (see below), in the wp-admin error_log. All my sites are (currently) running WP v4.7.2. All are running the latest version of the plugin. All run on the same cloud host.
The error is (I think) created when a web page is served. Sometimes I get 12 errors a minute. Sometimes a there are gaps of many minutes in the log. The log has built up to ~2MB in 6 weeks.
My websites are only family / small business sites, but I’d like to get them set up properly.
I have googled the error and my guess is that the plugin is trying to create a table with a key that is too big for my database. The limit on key length seems to be 100bytes for utf8mb4 DBs. People seem to think that this is a reasonable limit for a key.
Do you know if this is what is happening? And if there’s any way to fix things or apply a work-around, so that I can stop these errors being created?
Many thanks,
Dom.
Error:
[06-Jan-2017 12:49:32 UTC] WordPress database error Specified key was too long; max key length is 1000 bytes for query CREATE TABLE myuniquetableprefix_wpcsplog (
id mediumint(9) NOT NULL AUTO_INCREMENT,
violated_directive varchar(50) NOT NULL default ”,
blocked_uri varchar(1024) NOT NULL default ”,
document_uri varchar(1024) NOT NULL default ”,
useragent varchar(1024) NOT NULL default ”,
remoteaddress varchar(1024) NOT NULL default ”,
information text NOT NULL default ”,
createdon timestamp DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY id (id),
KEY violated_directive (violated_directive, blocked_uri),
KEY createdon (createdon)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci made by require_once(‘wp-load.php’), require_once(wp-config.php’), require_once(‘wp-settings.php’), do_action(‘plugins_loaded’), WP_Hook->do_action, WP_Hook->apply_filters, call_user_func_array, wpCSPAdmin::update_database, dbDelta
- The topic ‘WordPress database error Specified key was too long’ is closed to new replies.