MySQL Database Connection Problems

MySQL Database Connection Problems

You may have encountered these problems:

  • Error establishing a database connection
  • Warning: mysql_connect(): Access denied for user: 'username@localhost' (Using password: YES) in /home/what/public_html/catalog/includes/functions/database.php on line 19
    Unable to connect to database server!

If you have received these warnings, your database exists in cPanel but cannot communicate with the website. You will need to create a new user for the database and assign that user to the database. Instructions are located here.

Once you have created the new user and assigned them to the database in question, you must find the database configuration file. If you received the first error (Error establishing a database connection) then you can use this list of script configuration file locations to find your Database Configuration File.

4Images Gallery /config.php
B2 Evolution /conf/_basic_config.php
Boonex Dolphin /inc/
Concrete5 /site/config.php
Coppermine Photo Gallery /include/
Crafty Syntax Live Help /config.php
Cube Cart /includes/
dotProject /includes/config.php
Drupal /sites/default/settings.php
e107 /e107_config.php
FAQMasterFlex /faq_config.php
Gallery /config.php
Geeklog /db-config.php
glfusion /private/db-config.php
Hotaru /hotaru_settings.php
Joomla /configuration.php
LiveSite \local\config\lib\content_center\ livesite_customer_src\etc\conf\livesite_customer\
LifeType /config/
Magento /app/etc/local.xml
Mambo /configuration.php
MODx /core/config/
Moodle /config.php
MyBB /inc/config.php
Noahs Classifieds /app/config.php
Nucleus /config.php
ocPortal /info.php
osCommerce /includes/configure.php
PHP-Nuke /config.php
phpBB /config.php
phpFormGenerator /index.php
phpFreeChat (only if you have saved form input to a database)
PHPlist /config/config.php
phpMyDirectory /defaults.php
phpWCMS /include/inc_conf/
phpWebSite /conf/config.php
PhpWiki /admin.php
Pligg /libs/dbconnect.php
Post-Nuke /config.php
Saurus CMS /config.php
Siteframe /config.php
SMF /Settings.php
Soholaunch /sohoadmin/config/isp.conf.php
Textpattern /textpattern/config.php
Tiki /db/local.php
Trendy Site Builder (not applicable)
TYPO3 /typo3conf/localconf.php
vBulletin /includes/config.php
WebCalendar /includes/settings.php
WHMCS /configuration.php
WordPress /wp-config.php
X7 Chat /config.php
Xoops /mainfile.php
Zen Cart /includes/configure.php
Zikula /config.php

If you received the second type of error message, it included in it the location of the configuration file. Referring to the earlier example, the Database Configuration File location is here: /home/what/public_html/catalog/includes/functions/database.php.

Reconfiguring the Database Settings

  1. Find the configuration file and select "Edit".
  2. Find where the database name is defined. For a WordPress install, it will look like this:
    define('DB_NAME', 'user1_wrdp1');
    define('DB_USER'. 'user1_name1');
    define('DB_PASSWORD', 'Oha7d2AS%');
    define('DB_HOST', 'localhost');
  3. Make sure that your cPanel username is correct ('user1_wrdp1'). If it not, correct it, but leave the portion after the underscore alone.
  4. Replace the user and password information [define('DB_USER', 'UsernameHere'), define('DB_PASSWORD'. 'PasswordHere')]
  5. Make sure that the hostname is localhost.
  6. Save the file.


  • 33 Users Found This Useful
Was this answer helpful?

Related Articles

Do you offer password protected directories?

By default, cPanel allows you to password protect directories in your account that you wish to...

Why can't I log into my cpanel or webmail?

There various issues that you may not be able to login to your cPanel or WebMail. We have...

Custom Error Pages

Creating your own error pages can be accomplished through cPanel. After logging in, under...

Requesting a New cPanel Password

Resetting Your cPanel PasswordYou can reset your cPanel password from the cPanel login screen....

Secure cPanel Login

Using Shared SSL to Access cPanel Use https, enter your site's IP address, and the secure port...