I'm probably overlooking something but I'm having trouble with this still. I need to share user tables between 2 Drupal installations. Each database is on a different domain, different server. Everything I've seen talks about sharing tables with both DBs on the same server or sharing some aspect of the install. I've tried a few things in settings.php and the databases, but so far nothing is working. Figured I would ask if this is even possible before I continue spinning my wheels on it.

Comments

peterx’s picture

The first question is about registering new users. Do users of A.com register at A.com then become users of B.com? What about people registering at B.com?

There is the Drupal groups approach where you register at drupal.org then logon at groups.drupal.org using name@drupal.org. That is using a service to pass a logon to another site.

There are replication features in MySQL. You could have everyone register at A.com and have MySQL replicate the changes to B.com.

If you have people registering independently at A.com and B.com then xyz could register at A.com, a completely different xyz registers at B.com, then one of the xyz's tries to logon at the other site. Now you need both sites checking the other site during registration.

If you grow beyond two sites, you might want to nominate A.com as the main site, redirect everyone to A.com for registration, then have all other sites check A.com.

You use separate servers. Are they at the same data centre? If so then the administrator could create a share from one server to the other and MySQL could share a table at that level.

B.com could use ODBC to access the user table at A.com.

If the servers are at different data centres then you could share data using services. You then end up with flexibility similar to the groups.drupal.org.

Will you always have exactly two sites?
Are they always at the same data centre?
If you have your site hosted, have you asked your host about sharing tables?

petermoulding.com/web_architect

irishsuperfly’s picture

I am in a bit of a time crunch, so I guess the easiest thing to do is put both sites under the same hosting account. I was hoping to house each site on a different account for the sake of keeping things "neat" and restricting access. For now, there are only 2 sites, hosted by the same place and basically on the same server (I just had them set up under separate accounts).

Maybe I'm thinking of the shared tables the wrong way... I thought if I pointed site2's DB to site1's user tables when a user signed up on site2, their info was actually entered into site1's DB. There would be no concern for duplicating/replicating the info since site2 would refer to site1 for any user data. Is that wrong?

I tried entering the url info for site1 in settings.php in place of "localhost". I used the login info for the DB user on site1. When I uploaded the changed settings.php to site2, I got an error that my user did not have access to the DB. I also had the default settings in there for site2's DB. I'm not sure if I just entered things wrong for settings.php or if it simply will not work that way.

Eventually, we hope to have many more sites that could share user data. So long-term, I'd have to find some way to make this work on separate hosting accounts and possibly separate servers/data centers.

Thanks for your input, Peter!