1. Home
  2. Knowledge Base
  3. Web hosting
  4. What is a database connection string?

What is a database connection string?

A connection string is the piece of information that is needed for your application to reach your database, for example a database name, username, password, port etc…

Example of a PHP connection string:

WordPress:

define('DB_NAME', 'ID111111_database_name');
/* MySQL database username /
define('DB_USER', 'ID111111_user_example'');
/* MySQL database password /
define('DB_PASSWORD', 'database-password');
/* MySQL hostname /
define('DB_HOST', ‘mysql001.webhosting.be');

Joomla:

public $host = ‘mysql001.webhosting.be';
public $user = 'ID111111_user_example';
public $password = 'database-password';
public $db = 'ID111111_database_name';

Drupal:

$databases = array (
    'default' =>
    array (
        'default' =>
        array (
            'database' => 'ID111111_database_name',
            'username' => 'ID111111_user_example’,
            'password' => 'database-password',
            'host' => ‘mysql001.webhosting.be',
            'port' => '',
            'driver' => 'mysql',
            'prefix' => '',
        ),
    ),
);
Updated on 8 March 2020

Was this article helpful?