Reference to another database as a prefix I have a problem referencing another database as a prefix in my settings.php file.I have a master-site[mysite.local] and a slave [sub.local].Both of them are having separate database.I need to check the users table of the master-site as well as the users table of the slave site ,when a user tries to authenticate to the slave which is sub.local.I tried adding the following in the settings.php file of the slave

$databases = array (
  'default' =&gt; 
  array (
    'default' =&gt; 
    array (
      'database' =&gt; 'sub_drupal', //Database for the slave site
      'username' =&gt; 'root',
      'password' =&gt; '',
      'host' =&gt; 'localhost',
      'port' =&gt; '',
      'driver' =&gt; 'mysql',
      'prefix' =&gt; array(
                'default'   =&gt; 'sub_drupal.',
                'users'     =&gt; 'study.', //parent database
                'sessions'  =&gt; 'study.',
                'role'      =&gt; 'study.',
                'authmap'   =&gt; 'study.',
                'users_roles'   =&gt; 'study.',
            ),
    ),
  ),
);


But now it authenticates users only on the parent database.Is it not possible to authenticate users present in the slave database sub_drupal and also in the parent database study.Hope someone could help me with this.Thanks
You have the format wrong for two databases you need something like this:

$databases = array(
  'default' =&gt; array(
    'default' =&gt; array(
      'database' =&gt; 'd7',
      'username' =&gt; 'root',
      'password' =&gt; 'root',
      'host' =&gt; '127.0.0.1',
      'port' =&gt; '',
      'driver' =&gt; 'mysql',
      'prefix' =&gt; '',
    ),
  ),
  'db2' =&gt; array(
    'default' =&gt; array(
      'database' =&gt; 'd7_parent',
      'username' =&gt; 'root',
      'password' =&gt; 'root',
      'host' =&gt; '127.0.0.1',
      'port' =&gt; '',
      'driver' =&gt; 'mysql',
      'prefix' =&gt; '',
    ),
  ),
);


You can then use db_set_active('db2'); to change the connection and begin querying the second database.