MySQL uses the underscore ('_') in a LIKE query to mean "any character", so when the table prefix includes this character it can match tables that it shouldn't. In my case, I had a multisite already created with a prefix of "brief_" and then tried to add "br_", but couldn't because MM detected that the tables already existed.

I made the following changes to change underscores to escaped underscores for $new_db['prefix'] (sorry; didn't create a patch - I can if necessary).

$ grep -n '\\_' multisite_manager.module
471:    $already_exists = db_result(@db_query("SHOW TABLES FROM %s LIKE '%s%%'", $new_db['path'], str_replace('_', '\_', $new_db['prefix'])));
476:      $already_exists = db_result(@db_query("SHOW TABLES FROM %s LIKE '%s%%'", $new_db['path'], str_replace('_', '\_', $new_db['prefix'])));

-Doug

Comments

schuyler1d’s picture

Status: Active » Fixed

thanks. this is fixed in 5.x-1.0-beta2

sorry for the delay. i was out on a 3 week vacation.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.