Truemag

  • Categories
    • Tips And Tricks
    • Internet
    • PHP
    • Javascript
    • CSharp
    • SQL Server
    • Linux
  • Lastest Videos
  • Our Demos
  • About
  • Contact
  • Home
  • Write With Us
  • Job Request
Home Resources Where Drupal Database Configuration Settings

Where Drupal Database Configuration Settings

I’ve received a request to modify some pages of a website which is based on Drupal. Unfortunately, I hear about Drupal so many times but I don’t have any experience about it at all.

After download all current source files and database to my staging, I spent half of hour to find out where do I re configure the database settings as it’s not the same with the live settings.

In this article, I would like to take note it because I don’t want to spend another half of hour to find it again in a near future and it may save someone time, hopefully.

Database Configuration Settings In Drupal

It’s located at drupal/sites/default/settings.php similar with below:

[text highlight=”48″] /**
* Database settings:
*
* Note that the $db_url variable gets parsed using PHP’s built-in
* URL parser (i.e. using the "parse_url()" function) so make sure
* not to confuse the parser. If your username, password
* or database name contain characters used to delineate
* $db_url parts, you can escape them via URI hex encodings:
*
* : = %3a / = %2f @ = %40
* + = %2b ( = %28 ) = %29
* ? = %3f = = %3d & = %26
*
* To specify multiple connections to be used in your site (i.e. for
* complex custom modules) you can also specify an associative array
* of $db_url variables with the ‘default’ element used until otherwise
* requested.
*
* 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_’,
* );
*
* Database URL format:
* $db_url = ‘mysql://username:[email protected]/databasename’;
* $db_url = ‘mysqli://username:[email protected]/databasename’;
* $db_url = ‘pgsql://username:[email protected]/databasename’;
*/

$db_url = ‘mysqli://db-user:[email protected]/db-name’;
$db_prefix = ”;
[/text]

Or in the current of Drupal (7.7):

[text highlight=”30,31,32,33″] * Database configuration format:
* @code
* $databases[‘default’][‘default’] = array(
* ‘driver’ => ‘mysql’,
* ‘database’ => ‘databasename’,
* ‘username’ => ‘username’,
* ‘password’ => ‘password’,
* ‘host’ => ‘localhost’,
* ‘prefix’ => ”,
* );
* $databases[‘default’][‘default’] = array(
* ‘driver’ => ‘pgsql’,
* ‘database’ => ‘databasename’,
* ‘username’ => ‘username’,
* ‘password’ => ‘password’,
* ‘host’ => ‘localhost’,
* ‘prefix’ => ”,
* );
* $databases[‘default’][‘default’] = array(
* ‘driver’ => ‘sqlite’,
* ‘database’ => ‘/path/to/databasefilename’,
* );
* @endcode
*/
$databases = array (
‘default’ =>
array (
‘default’ =>
array (
‘database’ => ‘drupal77’,
‘username’ => ‘root’,
‘password’ => ”,
‘host’ => ‘localhost’,
‘port’ => ”,
‘driver’ => ‘mysql’,
‘prefix’ => ”,
),
),
);
[/text]
Aug 22, 2011Hoan Huynh
How To Enable Telnet Command In Windows 7 And Server 2008Change Database Configuration Settings In CakePHP
You Might Also Like:
  • Change Database Configuration Settings In CakePHP
  • Is Drupal a little too complex?
  • Schedule Backup And Zip MySQL Database In Windows
  • How To Filter DataBase Name And Login Username In SQL Server Profiler
  • Export/Import Data From Local Database To Remote Database With MS SQL Server 2008
  • PHP Load Facebook Albums And Save To MySQL Database
  • Send Email Via Gmail SMTP Authentication With PHPMailer
  • Mysql restore database from dump file with GZIP compression
  • MSSQL Create Database With SQL Statement
  • PHP Send Email To Multiple Recipients And CC To Multiple Recipients With PHP Mailer
Hoan Huynh

Hoan Huynh is the founder and head of 4rapiddev.com. Reach him at [email protected]

9 years ago ResourcesDatabase, Drupal335
0
GooglePlus
0
Facebook
0
Twitter
0
Digg
0
Delicious
0
Stumbleupon
0
Linkedin
0
Pinterest
Most Viewed
PHP Download Image Or File From URL
22,166 views
Notepad Plus Plus Compare Plugin
How To Install Compare Text Plugin In Notepad Plus Plus
20,043 views
Microsoft SQL Server 2008 Attach Remove Log
Delete, Shrink, Eliminate Transaction Log .LDF File
15,821 views
JQuery Allow only numeric characters or only alphabet characters in textbox
13,302 views
C# Read Json From URL And Parse/Deserialize Json
9,792 views
4 Rapid Development is a central page that is targeted at newbie and professional programmers, database administrators, system admin, web masters and bloggers.
Recent Posts
  • Installment Loans – Making Sense of Online Software
  • Apple Pay Casino Canada
  • Casinos austria
  • Essay For Sale – How To Write A Superb One That Will Sell
  • Free Online Photo Editor
Categories
  • CSharp (45)
  • Facebook Graph API (19)
  • Google API (7)
  • Internet (87)
  • iPhone XCode (8)
  • Javascript (35)
  • Linux (28)
  • MySQL (16)
  • PHP (84)
  • Problem Issue Error (29)
  • Resources (32)
  • SQL Server (25)
  • Timeline (5)
  • Tips And Tricks (141)
  • Uncategorized (103)
Recommended
  • Custom Software Development Company
  • Online Useful Tools
  • Premium Themes
  • VPS
2014 © 4 Rapid Development