Receiving a "cannot connect to the database" error (particularly if you are a first-time or relatively novice PHP/MySQL user) indicates that you may have incorrectly entered the logon/connection info for your database. Here are a few initial things (common mistakes) to take a look at:
- Make sure that after you created your database and database user that you didn't forget to ADD the database user to the database (at the bottom of the "Databases" section in Control Panel > MySQL Manager you'll see two drop down menus "User:" and "DB:" followed by an "Add User to DB" button).
- Confirm that you entered localhost as the database host/server name and if applicable that you specified mysql for the database server type.
- Make sure that you specified the correct database and database user names. Besides noting the fact that these values are cAsE sEnSiTiVe be aware that your HostRocket userid (usually the first 7 characters of your domain name) is added with an underscore as a prefix to both your database and database user names (userid_dbname rather than just dbname and userid_dbuser instead of just dbuser).
- As far as the password make sure that you use the password that you assigned to your database user in MySQL Manager (NOT your HostRocket account password)
- if your domain name is "circuscity.com" - if your HostRocket userid is "circusc" - if you created a database named "phpbb" - if you created a database user named "bozo" - if you assigned user bozo the password "clown" - if you added bozo to the phpbb database
...then you would enter the following logon/connection info into the appropriate fields in your script or script setup dialog:
database server type = mysql server name = localhost database name = circusc_phpbb database user name = circusc_bozo database user password = clown