Changing the Database Configuration File of a CMS

For Web Hosting Packages and Managed Servers (Dedicated Hosting)

In this article, we'll show you how to update the database configuration of your website. These methods work with both MySQL and MSSQL databases.

Changes to the database configuration typically affect one or more of the following pieces of information that are required to connect the website to the database:

  • Database name
    Example: db123456789
  • Database host name (server name)
    Example: db123456789.hosting-data.io
  • Database user name
    Example: dbo123456789
  • Database password

An update of the database configuration is necessary if:

  • You updated your database password.
  • You want to use another database.
  • You moved your website to IONOS or into another IONOS contract.
  • If an update to the server infrastructure results in a change to your database host name. If this happens, we will prepare you for the changes well ahead of time.

Updating the Database Configuration

As a rule, Content Management Systems store the database configuration in their central configuration file. Therefore, you must first find out the name of this file. You can then download the configuration file to your computer, update it, and then upload it again.

Please Note

Improper changes to your configuration file can affect the functionality of your website. Therefore, you should always make a backup of the configuration file first.

  • Make a note of the name and location of the configuration file of your CMS. You can find this information in the lower part of this article.
  • Download the configuration file to your computer using an FTP program (Ex: Filezilla, WinSCP, Cyberduck, etc). If you are not sure how to do this, please see the article Transfer Files Securely with FTP.
  • Edit the configuration file on your computer with a text editor program. Find the lines that contain the old/obsolete information and replace them with the new/current information. As a Windows user, you can easily do this with the text editing program Notepad.
  • Upload the updated configuration file back into your webspace. Make sure you overwrite the existing version.

The change will take effect immediately. You should now open your website to test the effects of your changes.

Example

Scenario: You are running a WordPress website, and your database host name changes.

The following assumes that host name has been renamed from db123456789.perfora.net to db123456789.hosting-data.io. Accordingly, you must replace the old host name with the new one in the WordPress configuration file.

Download the configuration file wp-config.php from the root directory of your WordPress installation and look for the line beginning with define('DB_HOST'):
define('DB_HOST', 'db123456789.perfora.net');
Replace the old host name with the new one. In our example, the updated line looks like this

define('DB_HOST', 'db123456789.hosting-data.io');

Save the changes and then upload the file back to the same folder in your webspace. For more details about the database configuration, see the WordPress section below.

Names and Locations of Popular CMS Configuration Files

In the following summaries, you can find what the configuration file of your CMS is named and where you can find it in your webspace.

Notes
  • If you installed your website through the IONOS App Center, you will find installation files in the clickandbuilds directory.
  • If your website is running on a Managed Server with a MySQL 5.5 database, the database server (host) configuration is simply "localhost" or "localhost:/tmp/mysqld.sock".

WordPress

The configuration file of WordPress is called wp-config.php and is located in the root directory of your WordPress installation.

Example path: clickandbuilds/WordPress/wp-config.php

/** The name of the database for WordPress */
define('DB_NAME', 'db123456789');

/** MySQL database username */
define('DB_USER', 'dbo123456789');

/** MySQL database password */
define('DB_PASSWORD', 'Secret_Password');

/** MySQL hostname */
define('DB_HOST', 'db123456789.hosting-data.io'); 

/** WordPress Database Table prefix.
$table_prefix = 'abcd';

Joomla!

The configuration file of Joomla! is called configuration.php and is located in the root directory of your Joomla! installation.

Example path: clickandbuilds/Joomla/MyCMS1/configuration.php

public $host = 'db123456789.hosting-data.io';
public $user = 'dbo123456789';
public $password = 'Secret_Password';
public $db = 'db123456789'; 
public $dbprefix = 'abcd_';

PrestaShop

Prestashop version 1.7 and higher

Since PrestaShop 1.7 the configuration file is called parameters.php and is located in the app/config subdirectory of the Prestashop installation.

Example path: /clickandbuilds/PrestaShop/MyeCommerce/app/config/parameters.php

'database_host' => 'db123456789.hosting-data.io',
'database_port' => '',
'database_name' => 'db123456789',
'database_user' => 'dbo123456789',
'database_password' => 'Secret_Password',
'database_prefix' => 'abcd_',

Prestashop 1.5-1.6

For older PrestaShop versions 1.5 and 1.6 the configuration file is called settings.inc.php and is located in the /config subdirectory of the Prestashop folder.

Example path: /clickandbuilds/PrestaShop/MyeCommerce/config/settings.inc.php

define('_DB_SERVER_', 'db123456789.hosting-data.io');
define('_DB_NAME_', 'db123456789');
define('_DB_USER_', 'dbo123456789');
define('_DB_PASSWD_', 'Secret_Password');
define('_DB_PREFIX_', 'abcd_');

Moodle

The Moodle configuration file is called config.php and is located at the root of your Moodle installation.

Example path: /clickandbuilds/Moodle/MyMoodle/config.php

$CFG->dbhost    = 'db987654321.hosting-data.io';  
$CFG->dbname    = 'db987654321';     // database name, eg moodle
$CFG->dbuser    = 'dbo987654321';   // your database username
$CFG->dbpass    = '1234567890';   // your database password
$CFG->prefix    = 'abcd_';       // prefix to use for all table names

Drupal

Path and name of the configuration file: /sites/default/settings.php

'database' => 'db123456789',
'username' => 'dbo123456789',
'password' => 'Secret_Password',
'prefix' => 'abcd_',
'host' => 'db123456789.hosting-data.io',

TYPO3

The configuration file of Typo3 is called LocalConfiguration.php and is located in the subdirectory /typo3conf of your Typo3 folder.

'dbname' => 'db123456789',
'host' => 'db123456789.hosting-data.io',
'password' => 'Secret_Password',
'user' => 'dbo123456789',