Execute one MySQL command across all databases on the server http://stackoverflow.com/questions/10689735/how-to-do-mass-sql-operation-in-phpmyadmin
-- Connect to your mysql server
mysql_connect(...);
-- Execute command which gets you list of all database from mysql server
$rs = mysql_query("SHOW DATABASES");
-- Loop through all of them and execute your sql statements;
while ( $ds = mysql_fetch_assoc($rs) )
{
mysql_select_db( $ds['Database'] );
$sql = "some sql";
mysql_query($sql);
}