Need a few example queries for updating hundreds of MySQL databases with similar table prefix in their names

Job ID: 37712828

Budget: $30 – $250 USD

I have a project on CPanel (and I have a WHM) on my VPS. We have hundreds of basic/core php sites with MySQL databases that all start with samename_ like: samename_dbname1, samename_dbname2 and so forth. Each database has the same, identical structure and tables and columns.

I think I can use the schema naming logic to update the same table, column and record in ALL of my tables from one query but I am not experienced in which schema names identify:

All databases
A particular table within those databases
A particular record within those databases

For example, what if I want this query?

UPDATE db.pages SET title = "Learn XYZ" WHERE id=1

I guess that db would simply need to be some schema name that identifies any database or any database that starts with samename_

Sometimes I'll need to insert the same exact record into the same table in every database also.