MYSQL – Querying multiple wordpress databases at once ?

I need to execute an cleaning operation on my mysql databases,

I have 140 wordpress databases under the same connection.

Read More

I have ~30 forbidden words.

I need to query all wp-post tables post-content columns find these 30 words,
and remove the rows that include one of these words.

I must do it on each databases at once!

Related posts

Leave a Reply

1 comment

  1. You could write a small program in java or c# to actually loop through all the databases.

    If you execute
    show databases; this will retrieve all the databases that are present on you connection. From there I assume you know the tables on which you want to query for your forbidden words. Then you can loop within this new application for each database present and you will be able to query the wanted table.

    Let me know if this is what you were expecting. If you want some code sample let me know.