In certain installations, MySQL has ANSI compatibility active, in this scenario all the strings must be quoted with single quote, and I think this is the secenario for MySQL new versions.
In wp-includes/classes.php in this file in lines 595-611 the code have double quotes for strings, like in this example:
$where .= ' AND (post_status = "attachment")';
This causes a MySQL error. This error can be avoided by changing the quotes:
$where .= " AND (post_status = 'attachment')";