Title: WordPress database error: [Column &#8216;option_value&#8217; cannot be null]
Last modified: June 19, 2018

---

# WordPress database error: [Column ‘option_value’ cannot be null]

 *  [Lukasz](https://wordpress.org/support/users/wpfed/)
 * (@wpfed)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/wordpress-database-error-column-option_value-cannot-be-null/)
 * Hi,
 * When attempting to ‘save changes’ in WordPress admin, the following error displays:
   (
   example settings->discussion->uncheck(Attempt to notify any blogs linked to from
   the article) and click ‘save changes’)
 * WordPress database error: [Column ‘option_value’ cannot be null]
    UPDATE `wp_options`
   SET `option_value` = NULL WHERE `option_name` = ‘default_pingback_flag’
 * I have a few more errors that may be unrelated:
 * Warning: mysqli_query(): MySQL server has gone away in /var/www/html/site/wp-
   includes/wp-db.php on line 1924
 * Warning: mysqli_query(): Error reading result set’s header in /var/www/html/site/
   wp-includes/wp-db.php on line 1924
 * WP 4.9.6
    MySQL 5.7 PHP 7.2.4
 * Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [abletec](https://wordpress.org/support/users/abletec/)
 * (@abletec)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/wordpress-database-error-column-option_value-cannot-be-null/#post-10416140)
 * Hello, wpfed, & welcome. Those errors are actually likely not at all unrelated.
   For whatever reason, you’re getting database connection errors. These can be 
   caused by a variety of factors–a database that’s too large, not enough memory,
   a site unable to handle the amount of traffic you get, a corrupted database, &
   others, as well as a combination of such errors.
 * Were I in this particular situation–& I have been in the past when diagnosing
   clients’ websites–I’d check to see if your hosting provider’s control panel has
   a page that lists most recent errors. Perhaps that might be enlightening. I would
   also browse through your WordPress folder & subfolders to see if you have any
   files called error.log or error_log. You can open those up in your hosting provider’s
   file manager or an FTP client, hopefully one w/secure file transfer capabilities
   to see if there are entries corresponding or in proximity to these errors. You
   may also wish to open wp-config.php in your file manager & change wp_debug from‘
   false’ to ‘true’. Save the file, then do what you were doing to try to reproduce
   the error. You are advised that this poses a security risk, so change back to‘
   true’ when you’ve finished. That might give you an idea, however, if a specific
   plugin or theme is causing the error. Sometimes it’s also helpful to try disabling
   all plugins & temporarily switching to a default theme (they begin w/the word‘
   twenty’) to see if doing so resolves the error. If it does, then try reactivating
   the theme you had been previously using. If the site still works, then try reactivating
   plugins 1 by 1, each time doing what you need to do to reproduce the error, until
   the error recurs, at which time you’ve got a pretty good idea what plugin is 
   causing the problem.
 * I would, in this situation, also go to your hosting provider’s control panel &
   run a check on your database. That may tell you whether the database is corrupted.
   There is usually also an option to repair it.
 * You may also wish to contact your host to see if they’re seeing any mod_security
   errors thrown by your site.
 * If you feel this is over your head, & your host won’t help, there is a job board
   at [http://jobs.wordpress.net](http://jobs.wordpress.net) where you can post 
   a request to hire someone who can help you. I was a bit disappointed you didn’t
   post a site url so I could have a look. It might also be helpful if you’d tell
   us whether you’re running shared, VPS, or dedicated hosting.
 *  Thread Starter [Lukasz](https://wordpress.org/support/users/wpfed/)
 * (@wpfed)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/wordpress-database-error-column-option_value-cannot-be-null/#post-10418495)
 * Hi Jackie, thank you for the response.
 * I do have my hosting provider investigating this as well. I have already tried
   most as you have mentioned, it’s a managed hosting provider.
 * I will update once resolved, thanks!
 *  [abletec](https://wordpress.org/support/users/abletec/)
 * (@abletec)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/wordpress-database-error-column-option_value-cannot-be-null/#post-10419419)
 * Since you didn’t provide a site url, wpfed, it’s a lot harder to comment intelligently
   on this, assuming I’m capable of doing that in the first place, which is likely
   pretty iffy. Having said that, though, there’s a couple things I can say. I have,
   as noted in previous posts, encountered this sort of problem in the past. 1 of
   the solutions I’ve implemented is to archive the majority of the previous posts,
   converting them to HTML, disallowing robots, & linking to them from the menu.
   Sites on which that works well are those where the content is fairly time-sensitive,
   ie, news, sports, etc.
 * Another scenario in which I’ve seen this is when a site is being actively compromised.
   Obviously, eliminating that makes the problem disappear.
 * I often clear out databases when this happens of entries like spam comments, 
   some of the Akismet entries, etc. If the site is or has been compromised, then
   obviously a lot of those entries can be cleared as well. I often download the
   database & view it in a text editor capable of editing very large files, not 
   to edit it, of course, as that would nuke the database, but rather simply to 
   see what it contains & if there are any queries I can launch to delete unnecessary
   content. Obviously that gets pretty technical.
 *  [Shantanu Desai](https://wordpress.org/support/users/wpshades/)
 * (@wpshades)
 * [7 years, 8 months ago](https://wordpress.org/support/topic/wordpress-database-error-column-option_value-cannot-be-null/#post-10760553)
 * Hi [@wpfed](https://wordpress.org/support/users/wpfed/)!
 * Is the _Attempt to notify any blogs linked to from the article_(`default_pingback_flag`)
   options under Settings -> Discussion -> Default Article Settings unchecked on
   your site?
 * Also, is strict mode is enabled for your database(STRICT_TRANS_TABLES)?
    You 
   can check this by running the following from your MySQL prompt: `select @@sql_mode;`
 * If an option is unchecked, it is set to `null` by default here:
    [https://github.com/WordPress/WordPress/blob/e6ccdf161fd1e2c9d836081d148f1fbb16767574/wp-admin/options.php#L215](https://github.com/WordPress/WordPress/blob/e6ccdf161fd1e2c9d836081d148f1fbb16767574/wp-admin/options.php#L215)
 * But the wp_options table **does not** allow NULL as a value for options_value:
   
   [https://github.com/WordPress/WordPress/blob/1c2ff54037c1457cd079b20dbe987406b90f9645/wp-admin/includes/schema.php#L141](https://github.com/WordPress/WordPress/blob/1c2ff54037c1457cd079b20dbe987406b90f9645/wp-admin/includes/schema.php#L141)
 * This can cause the `Column xyz cannot be null` error if strict mode is enabled
   in your database. You could try disabling it and see if the error persists.
 * > If you are not using strict mode, then whenever you insert an “incorrect” value
   > into a column, such as a NULL into a NOT NULL column or a too-large numeric
   > value into a numeric column, MySQL sets the column to the “best possible value”
   > instead of producing an error
 * [https://dev.mysql.com/doc/refman/5.7/en/constraint-invalid-data.html](https://dev.mysql.com/doc/refman/5.7/en/constraint-invalid-data.html)
 * In this case, since `options_value` is of type `longtext` that default value 
   would be an empty string – ”.
 * FWIW, I don’t think the default value should be set to null if an option is unchecked.
   I think the default value should be an empty string `''`, since that’s what MySQL
   defaults to when strict mode is disabled.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘WordPress database error: [Column ‘option_value’ cannot be null]’ is 
closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 4 replies
 * 3 participants
 * Last reply from: [Shantanu Desai](https://wordpress.org/support/users/wpshades/)
 * Last activity: [7 years, 8 months ago](https://wordpress.org/support/topic/wordpress-database-error-column-option_value-cannot-be-null/#post-10760553)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
