I have privileges floating around in the
mysql.* tables pertaining to users, databases and tables which no longer exist. Is there a simple way to find and remove these orphaned entries?
This really isn't the simple way. But you could get some of what you want by composing a set of outer joins that would compare the privilege tables against information_schema tables. After comparing any privilege table to the schema you could then compare the user table against the privilege tables to find users without any privileges.
The challenging part is that most privilege tables allow you to use the
For example this will look for entries where There is a database(schema) without privileges, or a set of privileges that don't directly match a database.