I have made a Drupal 7 multi-site with 3 sites. Each site is running of the same Drupal install and has a separate database.
The database names are myhost_site1
, myhost_site2
and myhost_site 3
. (My hosting provider puts in the myhost_
automatically).
I need the 3 sites to share the users and user roles. I have read various tutorials and these are the steps I have followed:
Created a new database called
myhost_users
.Copied the following tables from
myhost_site1
TOmyhost_users
:users
,user_roles
,authmap
andsessions
Given the database users for each of 3 main databases access to
myhost_users
.Open the settings.php for each site and insert the following code (replacing the existing $databse definition):
$databases['default']['default'] = array( 'driver' => 'mysql', 'database' => 'NAME OF DATABASE', 'username' => 'DATABASE USER', 'password' => 'DATABASE PASSWORD', 'host' => 'localhost', 'prefix' => array( 'default' => 'NAME OF DATABASE', 'users' => 'myhost_users', 'sessions' => 'myhost_users', 'role' => 'myhost_users', 'authmap' => 'myhost_users', ), 'collation' => 'utf8_general_ci',
);
When I go to my site, I get the following error message:
Uncaught exception thrown in session handler. PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table
For the code posted in (4) I have tried using an underscore suffix for the database names (e.g,
myhost_users_
), but I still get an error message.
What am I doing wrong? Do I need any settings in sites/sites.php?
I would be open to using a module to do this.
Bakery is no good as it doesn't share user roles.
Account Sync shares roles, but it doesn't seem to work.
CAS requires phpCAS which I do not have access to.