[drupal-support] multiple sites

Chris Johnson chris at tinpixel.com
Wed Jun 15 20:37:34 UTC 2005


Christopher Taylor wrote:
> Hello,
>  
> If I want to host multiple sites and I change the $db_prefix in a new 
> settings.php file, do I have to re-import tables with the new prefix or 
> does drupal figure it out?
> What about aded modules and other additions?


If you want to prefix your tables so that you can host multiple site, avoid 
conflict with other existing tables from another application in the same 
database, or share tables between sites, etc., then you have to rename the 
database tables yourself to match the prefix values you use in the $db_prefix 
variable.  Drupal does not (can not) rename the tables for you.

The method by which you rename the tables depends on your situation and 
database.  In MySQL, you can issue a "RENAME TABLE foo TO bar" statement to 
rename table foo to table bar, for example.  So you do not need to re-import 
tables to do prefixing.

Added modules which have added tables will need to have their tables renamed 
as well, *IF* you likewise want to prefix them in $db_prefix, which you 
probably want to do if you are hosting multiple sites from one database, 
versus using prefixing for other purposes, e.g. shared tables, avoiding name 
collisions with existing tables, etc.

Hope this helps.

--
Chris Johnson




More information about the drupal-support mailing list