I Can’t Connect to my MySql Database

It is important to ensure that your website has the right MySQL database connection information set in your website's code, otherwise your website will not be able to create a successful database connection.

Configuration Settings

  • Host name = localhost (literally put localhost)
  • Database name = (cpanelUsername_databaseName)
  • Database username = (cpanelUsername_databaseUsername)
  • Database password = (the password you picked)

Code example

With the example account settings of:

  • cPanel username = paul1666
  • Database name = wrdp1
  • Database username = pauluser
  • Database user password = 4EtufEch

These settings would translate into the following code on your website.

// ** MySQL Settings ** //

/** The name of the database */ define('DB_NAME', 'paul1666_wrdp1');

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

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

/** MySQL hostname */ define('DB_HOST', 'localhost');