Nombre total de pages vues

mardi 22 janvier 2013

Wordpress you are not allowed to edit this post


Recently, I've met this error when I went create a new article on my Wordpress blog.
I tried to disable all plugins and activate the wordpress default theme but not solved.
Then I checked the php error log and I saw this error:


WordPress database error Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause for the query

                        SELECT COUNT(*) FROM wp_em_events ...



I've searched few days to understand that problem was related with the ONLY_FULL_GROUP_BY sql mode.
I had used the Percona tools web interface to generate my mysql config file and in effect this config file contains parameters for sql modes such as:

sql_mode                       = STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_AUTO_VALUE_ON_ZERO,NO_ENGINE_SUBSTITUTION,NO_ZERO_DATE,NO_ZERO_IN_DATE,ONLY_FULL_GROUP_BY


Solution for me was simply to disable the ONLY_FULL_GROUP_BY sql_mode by removing the parameter on the config line like this:

sql_mode                       = STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_AUTO_VALUE_ON_ZERO,NO_ENGINE_SUBSTITUTION,NO_ZERO_DATE,NO_ZERO_IN_DATE



Save the config file and restart the MySQL/MariaDB/Percona server to validate the new config.
Then, I've tried to write a new post on the wordpress blog but same issue again.
Now, this error can be checked into the php error log file:

WordPress database error Incorrect datetime value: '0000-00-00 00:00:00' for column 'post_date_gmt' at row 1 for query INSERT INTO wp_posts 

Here, a quick search helped me to find that the NO_ZERO_DATE sql mode was the cause of this error thus I removed this sql mode into the config file again like this:

sql_mode                       = STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_AUTO_VALUE_ON_ZERO,NO_ENGINE_SUBSTITUTION,NO_ZERO_IN_DATE

Saved and restart mysql server to validate.
After these both edits I can now write articles on the blog, very glad because lot of time was lost for this bullshit !