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/header.inc.php |
Concrete5 | /site/config.php |
Coppermine Photo Gallery | /include/config.inc.php |
Crafty Syntax Live Help | /config.php |
Cube Cart | /includes/global.inc.php |
dotProject | /includes/config.php |
Drupal | /sites/default/settings.php |
e107 | /e107_config.php |
FAQMasterFlex | /faq_config.php |
Gallery | /config.php |
Geeklog | /db-config.php /siteconfig.php /lib-common.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\database.properties |
LifeType | /config/config.properties.php |
Magento | /app/etc/local.xml |
Mambo | /configuration.php |
MODx | /core/config/config.inc.php |
Moodle | /config.php |
MyBB | /inc/config.php |
Noahs Classifieds | /app/config.php |
Nucleus | /config.php |
ocPortal | /info.php |
osCommerce | /includes/configure.php /admin/includes/configure.php |
PHP-Nuke | /config.php |
phpBB | /config.php |
phpFormGenerator | /index.php /mysql.class.php |
phpFreeChat | (only if you have saved form input to a database) /forms/admin/config.inc.php |
PHPlist | /config/config.php |
phpMyDirectory | /defaults.php |
phpWCMS | /include/inc_conf/conf.inc.php |
phpWebSite | /conf/config.php |
PhpWiki | /admin.php /lib/config.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 /admin/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
- Find the configuration file and select "Edit".
- 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'); - Make sure that your cPanel username is correct ('user1_wrdp1'). If it not, correct it, but leave the portion after the underscore alone.
- Replace the user and password information [define('DB_USER', 'UsernameHere'), define('DB_PASSWORD'. 'PasswordHere')]
- Make sure that the hostname is localhost.
- Save the file.
Â