I have several Drupal databases and core sites currently. What I want to have is several Drupal databases that share a common users database under one core site source. The reason I want this is so that I can restore a sites database from any date I choose without rolling back the other sites content as well. I have looked into prefixing but it sounds like all sites have to be under the same database, the same seems to be true of domain access.


3 Answers 3


Instead of using table prefixes, you can use a reference to another database as a prefix. For example, core database holds the shared users / permissions, drupal_website database is your actual website.

$databases['default']['default'] = array(
    'driver' => 'mysql',
    'database' => 'drupal_website',
    'username' => 'db_username',
    'password' => 'db_password,
    'host' => 'ip_db_server',
    'prefix' => array(
         'default' => '',
         'users' => 'core.',
         'users_roles' => 'core.',
         'sessions' => 'core.',
         'role' => 'core.',
         'role_permission' => 'core.',
         'authmap' => 'core.',

Minor drawback, your database needs to be stored on the same mysql server and each database uses the same credentials (username / password) for the connection.

  • I use this solution for a client of mine, and it works very well. The only problem I have is custom fields on users and syncing these values between sites.
    – pusle
    Commented Sep 23, 2013 at 7:54
  • @pusle - I know that this is old, but in case stumbles across this and needs help - if you have a custom user field with the machine name "field_first_name" then below 'authmap', add the following: 'field_data_field_first_name' => 'core.', - Essentially, you would just be also sharing those custom user fields with the core site. Hope this helps.
    – AndrewMRiv
    Commented Nov 17, 2017 at 18:22
  • Thank you @AndrewMRiv, that is good to know. Do you know if this works in Drupal 8?
    – pusle
    Commented Nov 17, 2017 at 18:39
  • 1
    Hi @pusle - Unfortunately, I have not had the change to dabble with Drupal 8 much yet so I am unsure. After I've learned more, I can update on this thread!
    – AndrewMRiv
    Commented Nov 17, 2017 at 18:42

If you install multiple Drupal instances inside the same database you will need to use a different prefix for each different Drupal site, so as far as I understand you cannot share the users table between them. And trying to sync that table yourself doesn't sound like a proper solution.

And as you say, using Drupal as a multi-site CMS alonside the Domain Access module is only possible for one single Drupal installation, in a single shared database.

If you need different Drupal sites installed in different databases, you could achieve what you want managing the user authentication outside Drupal. There are some Drupal modules already there, for example the Lightweight Directory Access Protocol (LDAP) module; or you could create your own authentication module, which is something not very difficult.


Try CAS module. Read the files README.txt and README_SERVER.txt for instructions on how to install and configure it.

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.