MySQL Workbench - store a query to apply to various schemas
In addition to what Rick wrote:

If you just wanna have an ad hoc solution (not something you frequently use) you could also just have your query in the editor without a schema and sequentially make each of the schemas you want to process the default schema by double clicking on it's name in the schema tree. I.e. make first one default, run the query. Make the next one default and run the query, and so on.