1

My webhost is pretty limited, and I only have one database user & schema. I would like to install multiple drupal installations on this database schema.

How do I tell each installation to prefix its tablenames with a given string?

1 Answer 1

2

In the settings.php file, a normal setup might look like

$databases['default']['default'] = array(
  'driver' => 'mysql',
  'database' => 'databasename',
  'username' => 'username',
  'password' => 'password',
  'host' => 'localhost',
  'collation' => 'utf8_general_ci',
);

The only difference is that you add a 'prefix', like this:

$databases['default']['default'] = array(
  'driver' => 'mysql',
  'database' => 'databasename',
  'username' => 'username',
  'password' => 'password',
  'host' => 'localhost',
  'prefix' => 'site1_',
  'collation' => 'utf8_general_ci',
);

Make the prefix different in each settings.php site, and you can have as many sites as you want within the same database.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.