Need to update your CMS database details?

Load WordPress Sites in as fast as 37ms!

Table of Contents

This post may contain affiliate links that I earn a small commission from at no cost to you. Please see my disclosure page for information.

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?

Drupal

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.

Magento

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

Section to edit:

<connection>
<host><![CDATA[hostname]]></host>
<username><![CDATA[DB username]]></username>
<password><![CDATA[DB pwd]]></password>
<dbname><![CDATA[DB name]]></dbname>
<active>1</active>
</connection>

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.

WordPress

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!

Fully Managed WordPress Hosting on SSD Drive

Subscribe To Our Newsletter

Get updates and learn from the best

More To Explore

Do You Want To Boost Your Business?

drop us a line and keep in touch

Sending out marketing emails?Download our Complete Email Marketing Checklist!