In my Drupal 7 installation I have:
- Main site: example.com
- Sub Domains: blog.example.com, forum.example.com (all in same domain)
I have database design in such a way:
- Main Site uses: main_db
- Sub Domain uses: blog_db, forum_db (all separate databases)
When the user register’s in main site, they should also able to use other sub-domains without registering again and again. I can copy/sync the users table from main_db to other dbs, but that not suitable solution. as it creates 3 instances of same data.
Is there any solution to store users table in main_db and access it via other dbs ? The proper term would be, how to share the users table from main database to other databases.
You can query from other databases in MySQL. Simply prefix the database in front of the table name.
This is from documentation of the SELECT statement:
Just make sure you edit the permissions so that your user can access the required databases.