When running WordPress or ClassicPress using a DigitalOcean managed MySQL database you may experience errors like the following:
Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'dbname.wp_posts.post_date' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by for query SELECT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, count(ID) as posts FROM wp_posts WHERE post_type = 'post' AND post_status = 'publish' GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date DESC made by require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), include('/themes/themename/404.php'), the_widget, WP_Widget_Archives->widget, wp_get_archives
Expression #1 of ORDER BY clause is not in SELECT list, references column 'dbname.wp_posts.post_date' which is not in SELECT list; this is incompatible with DISTINCT for query SELECT DISTINCT YEAR( post_date ) AS year, MONTH( post_date ) AS month FROM wp_posts WHERE post_type = 'attachment' ORDER BY post_date DESC made by wp_enqueue_media
More information including a suggested core patch is available at https://core.trac.wordpress.org/ticket/48377. In the meantime you can drop the mysql-no-ansi.php
file into the wp-content/mu-plugins/
folder of your site to fix this issue, or add the code into your theme's functions.php
file.
This change is slated to be included in WordPress 5.4 (https://core.trac.wordpress.org/ticket/48377) and ClassicPress 1.2.0 (ClassicPress/ClassicPress#558).