defining the db prefix in settings file

wolf_halton - March 8, 2008 - 01:08
Project:Organic Groups Sites
Version:5.x-1.x-dev
Component:Miscellaneous
Category:support request
Priority:normal
Assigned:Unassigned
Status:active
Description

I already had the drupal site up and its db prefix is 041 for reasons known only to the boss. It seems it would be easier to define the prefix in settings, however I am not sure where that would be updated.
* Hub site doesn't have required db prefix. Please set the db prefix of the hub site to hub_ or define the db prefix you're using in this site's settings file, see README.

is the file to fix sites/default/settings.php ?

* You can optionally set prefixes for some or all database table names
* by using the $db_prefix setting. If a prefix is specified, the table
* name will be prepended with its value. Be sure to use valid database
* characters only, usually alphanumeric and underscore. If no prefixes
* are desired, leave it as an empty string ''.
*
* To have all database names prefixed, set $db_prefix as a string:
*
*   $db_prefix = 'main_';
*
* To provide prefixes for specific tables, set $db_prefix as an array.
* The array's keys are the table names and the values are the prefixes.
* The 'default' element holds the prefix for any tables not specified
* elsewhere in the array. Example:
*
*   $db_prefix = array(
*     'default'   => 'main_',
*     'users'     => 'shared_',
*     'sessions'  => 'shared_',
*     'role'      => 'shared_',
*     'authmap'   => 'shared_',
*     'sequences' => 'shared_',
*   );
*
* Database URL format:
*   $db_url = 'mysql://username:password@localhost/databasename';
*   $db_url = 'mysqli://username:password@localhost/databasename';
*   $db_url = 'pgsql://username:password@localhost/databasename';
*/
$db_url = 'mysql://datasite_drup1:Q2u8e4set6@localhost/datasite_drup1';
$db_prefix = '041';

This looks like it does define the db prefix already. What am I missing?

#1

nedjo - March 8, 2008 - 01:51

In each sub-site using the existing site as a hub, include the following in the settings.php file:

<?php
define
('OG_SITES_HUB_PREFIX', '041');
?>

See the "Installation and setup" section in the README file, http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/og_sites/RE...

#2

caminoz74 - October 16, 2008 - 14:10

Hi,

I am not sure whats going on with my installation but the following has occurred on my local host testing server -

1. set up the hub site and placed 'define('OG_SITES_HUB_PREFIX', 'hub_');' in the settings.php.
2. set another site in a separate folder then identified the hub sites database name, username and password.
3. placed 'define('OG_SITES_HUB_PREFIX', 'hub_');' in the settings.php of the new site.
4. Switched on 'organic group sites' in the 1st sites modules.
5. went to the 2nd site and it comes up with the hub sites info without access to the extra module functions. i.e. if I change the site name it changes the site details in the hub site.

I am very confused and feel I may have done something incorrect in the db prefix... do I actually have to name the hub site in MyAdminPHP with the prefix 'hub_' otherwise I really done know how to do a prefix!!!

Might sound simple... i'm fairly new to drupal

thanks
heaps

 
 

Drupal is a registered trademark of Dries Buytaert.