I have this is my settings.php file for one (secondary site) site:
$db_prefix = array(
'default' => 'music_',
'users' => 'main_',
'sessions' => 'main_',
'role' => 'main_',
'authmap' => 'main_',
'sequences' => 'main_',
'profile_fields' => 'main_',
'profile_values' => 'main_',
'user_roles' => 'main_',
);
*
* Database URL format:
* $db_url = 'mysql://username:password@localhost/database';
* $db_url = 'pgsql://username:password@localhost/database';
*/
$db_url = 'mysql://username:password@localhost/database';
$db_prefix = 'music_';
-------------------------------------------------
And for the main or first site:
$db_url = 'mysql://username:password@localhost/database';
$db_prefix = 'main_';
If I comment out $db_prefix = 'music_'; the pages go blank and the site will not use the main_ which are the shared tables. I created a user on the music site and it showed up in the music_user table not the main_user. Multisites is working fine but I am unable to share tables. Can anyone help? I am using 5.1. I do have the db_url setup correctly just removed my info for safety.
Thanks!
Comments
I have tried this a million ways
and cannot figure out what what I am doing wrong. Any help would be greatly appreciated. Thanks
Right idea, wrong place.
Looking at what you posted from settings.php for the secondary site what you've done is uncomment and change the '$db_prefix as array' example. It's the $db_prefix after the comments you needed to change (line 94).
---------------------------------------------
THE MIND: PHENOMENAL COSMIC POWER... in an itty bitty living space
THANK YOU!
I knew it was something silly. I appreciate it.
What are the tables that need to be shared to only share users and not anything else? So that the user info stays straight?
Pretty much what you had
The minimum to share only users is
'users'
'sessions'
'authmap'
'sequences'
If you're using profile module and want profiles on both sites you also need to share
'profile_fields'
'profile_values'
Whether or not to share roles and users_roles is up to you. If you're only going to use core roles anonymous and authenticated then I wouldn't bother. If you're going to have broadly the same non core roles on each site
e.g. each site has content editor, store administrator and site administrator roles then I'd share the roles table. And if you're going to have the same users in the same non core roles across both sites then share role and users_roles.
---------------------------------------------
THE MIND: PHENOMENAL COSMIC POWER... in an itty bitty living space
Thanks for your good
Thanks for your good explanation of the different scenarios!
Very helpfull!
-----------------------------------------
Joep
CompuBase, websites and webdesign
-----------------------------------------
Joep
CompuBase, Dutch Drupal full service agency
$db_prefix is overwritten by installer.
Hi Thanks for your post.
I have found that for a new install, where I want to use the db_prefix with some shared tables for users and of course separate tables for most tables, I pre configurer the settings.php file for the $db_prefix as an array, but the installer overwrites the db_prefix, and produces a PHP error on the installer page.
Immediately after this, if I reapply to the settings.php file the db_prefix settings I want, and then refresh the installer page, it installs the the tables the way I want.
Original settings.php
gets overwritten in db_prefix (which is bad), and of course in the db_url connection data (which is good)
Example
Immediately I change the settings.php file db_prefix back to the initial, and refresh the drupal install browser page.
The install succeeds, with shared tables being 'shared_...' and everything else being the default 'prefix...'.
This also succeeds for the second Drupal site in the same database. It does complain about the shared tables already existing, but after this initial warning the second site works fine too.
same problem
I am having the same problem with the overwrite. The workaround works for the first site, but not later sites.
See also
http://devbee.com/user_sequence_gotcha
--
Devbee - Open Source Business Solutions - http://devbee.com/
--
Devbee - http://devbee.net/