Posted by drale01 on May 31, 2011 at 8:29pm
Hi,
is it possible to make that?
For example:
$db_url = 'mysqli://user1:password@localhost/sqlbase1';
$db_prefix = array(
'default' => '',
'authmap' => 'shared_sqlbase2.',
'sessions'=> 'shared_sqlbase2.',
'users' => 'shared_sqlbase2.',
);
but shared_sqlbase2 has different owner and user1 has no privileges to shared_sqlbase2.
Is there any way to put user2 (with his password) who is owner of shared_sqlbase2 with full privileges?
Please help me..
Comments
Drupal 7 supports this
Drupal 7 supports this natively. You define some databases and then tell it which tables go into which database. There is also support for 'master/slave' DB setups. Check out default.settings.php in a Drupal 7 installation, or check it out here: http://api.drupal.org/api/drupal/sites--default--default.settings.php/7/...
OK drupal 7 but drupal 6
Hi Mile23,
how to make this on drupal 6 settings.php?
Grant access
The easiest would be to grant access within db to users which need to be able to do queries. So if user1 needs access to shared_db, grant select permissions (and other permissions as well) to that user to the database.
--
Perttu Ehn
I can't...
I know that but I can't do that.
Because It's two databases on two different cPanels on one WHM.
In my WHM, access is granted to databases from one cPanel to another. But I can't give permissions to user1 in cPanel 1 to database2 in cPanel 2.
So I need describe two users in my settings.php
I think it is not possible to
I think it is not possible to give two separate database credentials and use this setting as a base of multisite with shared database. I may bo wrong, though.
Can you set up both of your sites to use one database with database name prefixes? See http://drupal.org/node/291373
--
Perttu Ehn
Idea...
rpsu you give me good idea...
Example:
I'll put all SQL databasis on cPanel 1 for every site. Every databasis has all privileges to user 1:
Database-site1, database-site2, and shared-database are on Cpanel 1. User1 is on cPanel 1.
Site1 is on cPanel 1, site2 is on sPanel 2.
settings.php for site 1 on cPanel 1 looks like this:
$db_url = 'mysqli://user1:password@localhost/Database-site1';
$db_prefix = array(
'default' => '',
'authmap' => 'shared-database.',
'sessions'=> 'shared-database.',
'users' => 'shared-database.',
);
settings.php for site 2 on cPanel 2 looks like this:
$db_url = 'mysqli://user1:password@localhost/Database-site2';
$db_prefix = array(
'default' => '',
'authmap' => 'shared-database.',
'sessions'=> 'shared-database.',
'users' => 'shared-database.',
);
I think it would work - I must try later...
works
It works...
Use of ONE database, not two
Using one database for all would be more like this. This requires both sites to be on same server (localhost). If they are on separate sites, you need to change 'localhost' in $db_url to some ip-address and make sure mysql-port (usually 3306) is open.
settings.php for site 1
$db_url = 'mysqli://user1:password@localhost/Database-site1';$db_prefix = array(
'default' => 'site1_', // NOTE: default prefix, this will separete site1 & site2 content
'authmap' => 'shared_stuff_', // NOTE: shared tables use identical prefixes
'sessions'=> 'shared_stuff_',
'users' => 'shared_stuff_',
);
settings.php for site 2
$db_url = 'mysqli://user1:password@localhost/Database-site1';$db_prefix = array(
'default' => 'site2_', // NOTE: default prefix, this will separete site1 & site2 content
'authmap' => 'shared_stuff_', // NOTE: shared tables use identical prefixes
'sessions'=> 'shared_stuff_',
'users' => 'shared_stuff_',
);
--
Perttu Ehn
you can connect to two from
you can connect to two from the same settings.php file if you're still interested in that approach. Here's an example from one of our many sites doing this:
$db_url['default'] = 'mysqli://user:pass@servername/db2';$db_url['db1'] = 'mysqli://user:pass@servername/db1';
$db_prefix = array(
'default' => '',
'users' => 'db1.',
'authmap' => 'db1.',
'profile_fields' => 'db1.',
'role' => 'db1.',
'tinymce_settings' => 'db1.',
'tinymce_role' => 'db1.',
);
You can then connect to the other site if you want to from the first one or just share tables over to it. Network Manager is outdated by now but the code switches to other DBs to query stats for reports so the code might be useful to check out if your still pursuing this. http://drupal.org/project/network_manager
Ex Uno Plures
http://elmsln.org/
http://btopro.com/
http://drupal.psu.edu/
Great!!
Yes I'm interested this is great. I founded solution before this but this is better way.
Thank you...