OllieJones / index-wp-mysql-for-speed

A plugin to add useful indexes to your WordPress installation's MySQL database.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Query Error when checking user privileges

OllieJones opened this issue · comments

On a NearlyFreeSpeech.net - hosted site (FreeBSD) the Query Monitor shows this query-error message.

SELECT COUNT(*) numFROM mysql.userWHERE CONCAT_WS('@', User, Host) = USER()AND Process_priv <> 'Y'/**imfs-query-tag*397099888*/ 
+ImfsDb->get_results()
Plugin: index-wp-mysql-for-speed
Illegal mix of collations (utf8mb4_general_ci,COERCIBLE) and (utf8mb4_unicode_ci,COERCIBLE) for operation '<>'  
1267

Everything works otherwise.

Looks like a clash of cultures.

(This bug was discovered by this repo's owner)

The query is in the plugin. Its purpose is to determine whether the active database user has the PROCESS priv, before attempting to read the information_schema.INNODB_METRICS table. Reading the mysql.users table is the canonical way of doing that. I guess this query failed because of a mismatch between the enum's collation and the connection collation. On that particular configuration. Right now it's cosmetic only; it prevents the uploaded metadata from including the INNODB_METRICS table. It might, in future, figure more into choosing indexes.

The problem is this: WordPress logs caught database exceptions. There've been some complaints from users about that. So I'm trying to prevent those database exceptions. At any rate, fixed.