1. bluehost knowledge base

MySQL Errors

If you are having connection errors, please make sure you have followed the instructions on our Remote Database Connection Setup article.

The most common problem in connecting is due to an incorrect username and/or password. Please make sure the username you use matches the username created in the "MySQL Database" section of your cPanel.

Examples of MySQL Errors:

Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'Username'@'localhost' (using password: YES) in /home1/examplec/public_html/config.php on line 3
Couldn't connect to server.

This kind of error clearly shows the issue. Access denied lets you know immediately that the database user or password is incorrect in your PHP file. If you see this error, open the PHP file and make sure the username and password are correct. The database and username must always have the appropriate prefix of username_ (replace username with your actual cPanel username and don't forget the underscore "_"). You can copy the correct spelling from your cPanel, under "MySQL Databases" section.

Parse error: syntax error, unexpected T_STRING in /home1/examplec/public_html/index.php on line 31

This kind of error means you have made a mistake in your coding. Generally, it is missing punctuation, as PHP code is very sensitive. Issues dealing with scripting, coding, or third party products may be best consulted with a professional programmer, design group, or developer of the third-party product.