Posted by ivan zugec on November 9, 2009 at 5:01am
Hi,
I have been working on setting up a multisite + single sign on site, I did this by adding the following to the settings.php.
$db_url = 'mysqli://username:password@localhost/databasename';
$db_prefix = array(
'default' => '',
'authmap' => 'shared.',
'role' => 'shared.',
'sessions' => 'shared.',
'users' => 'shared.',
);It's working fine if all the databases are on the same server.
But is there a way of telling Drupal to connect to a different mysql server to access the authmap, role, sessions and users tables?
Something like this??:
$db_url['default'] = 'mysqli://username:password@localhost/databasename';
$db_url['shared'] = 'mysqli://username:password@192.168.0.1/user_shared';Thanks
Comments
If you're using another db
If you're using another db ('shared') you need to switch to this database BEFORE you can run queries to this database. I guess this is not possible, since you would need to switch server/connection always while needing to get stuff from shared-tables.
See this db_set_active api.
--
Perttu Ehn
Possibly now available in Drupal 7
I realise that this is now an old issue, but for anyone looking to do something similar ...
In the Drupal 7 settings.php file, there's an array of database connection settings, so this may now be possible.
This is the comment from the file:
Also
Possible with Pressflow 6:
https://bugs.launchpad.net/pressflow/+bug/627247