Is there a way to prefix all existing tables in mysql without manually altering each one? I am trying to use same database for a multisite, I have a lot of tables which I would like to be prefixed eg with wwp_
Something like this might work: // connect to the database $prefix = "wwp_"; $result = mysql_query("SHOW TABLES"); while($row = mysql_fetch_row($result)) { $rename = mysql_query("RENAME TABLE " . $row[0] . " TO " . $prefix . $row[0]); } PHP: