A database connection string is composed of four parameters. You need a hostname/server, a database name, a database user, and a database password for the user. We will list below some of the most common scripts and where to find their database connection strings.
WordPress
WordPress keeps the connection information in the file wp-config.php . The file is located at the root of the installation.
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define( 'DB_NAME', 'database_name_here' );
/** MySQL database username */
define( 'DB_USER', 'username_here' );
/** MySQL database password */
define( 'DB_PASSWORD', 'password_here' );
/** MySQL hostname */
define( 'DB_HOST', 'localhost' );
AbanteCart
The path to the file containing the database string is /system/config.php
// Database Configuration
define('DB_DRIVER', 'amysqli');
define('DB_HOSTNAME', 'localhost');
define('DB_USERNAME', 'database_username');
define('DB_PASSWORD', 'database_password');
define('DB_DATABASE', 'database_name');
define('DB_PREFIX', 'prefix_');
PrestaShop
The location of the config file is /config/settings.inc.php
define('_DB_SERVER_', 'localhost');
define('_DB_NAME_', 'database_name');
define('_DB_USER_', 'database_user');
define('_DB_PASSWD_', 'database_password');
define('_DB_PREFIX_', 'pswb_');
define('_MYSQL_ENGINE_', 'InnoDB');
Joomla
The file with the database string is presented at the root of the installation. The file name is configuration.php
public $dbtype = 'mysqli';
public $host = 'localhost';
public $user = 'database_username';
public $password = 'database_password';
public $db = 'database_name';
public $dbprefix = 'prefix_';
Drupal
The configuration file for database connection is /sites/default/settings.php
$databases['default']['default'] = array (
'database' => 'database_name',
'username' => 'database_username',
'password' => 'database_password',
'prefix' => 'prefix_',
'host' => 'localhost',
'port' => '3306',
'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql',
'driver' => 'mysql',
);
Moodle
The configuration file containing the string is located in the root of the installation – config.php
$CFG->dbtype = 'mysqli';
$CFG->dblibrary = 'native';
$CFG->dbhost = 'localhost';
$CFG->dbname = 'database_name';
$CFG->dbuser = 'database_username';
$CFG->dbpass = 'database_password';
$CFG->prefix = 'prefix_';
$CFG->dboptions = array (
'dbpersist' => 0,
'dbport' => '',
'dbsocket' => '',
'dbcollation' => 'utf8_general_ci',
);