Need to update your CMS database details?

Ever needed to update the database name, user or password for your content management system? The most common time I find I need to do this is when I’m moving a website from one server to another. Sometimes you can replicate the database details exactly, sometimes you can’t.

I work predominately with Drupal, Magento and WordPress content management systems. So where do you find the configuration for the database in these systems?


File location from document root: /sites/default/settings.php

Section to edit:

$databases = array (
default’ =>
array (
‘default’ =>
array (
‘database’ => ‘name’,
‘username’ => ‘username’,
‘password’ => ‘pwd’,
‘host’ => ‘localhost’,
‘port’ => ”,
‘driver’ => ‘mysql’,
‘prefix’ => ”,

Just edit the section between the apostrophe’s on the right-hand side of the =>. These should be your database name, your database username and your database password.


File location from document root: /app/etc/local.xml

Section to edit:

<username><![CDATA[DB username]]></username>
<password><![CDATA[DB pwd]]></password>
<dbname><![CDATA[DB name]]></dbname>

Only edit the sections in [square brackets], most specifically username, pwd and name. As the XML suggests, these are the database username, database password and database name.


File location from document root: /wp-config.php

Section to edit:

define(‘DB_NAME’, ‘name’);

define(‘DB_USER’, ‘username’);

define(‘DB_PASSWORD’, ‘pwd’);

Again, just edit the sections between the apostrophe’s on the right-hand side to change the database name, username and password.

Apply your changes

Once you are done any changes, upload your new settings file to the appropriate location on the server and unless there is something else on the server impacting your website, you should be good to go.

Note: While these changes are pretty easy, a knowledge of FTP and a basic understanding of PHP (or XML for Magento) is recommended. Not sure about doing it yourself? Contact us for pricing to do this for you!

0 responses on "Need to update your CMS database details?"

Leave a Message

Your email address will not be published. Required fields are marked *

© TerraMedia. All rights reserved.