Home > MySQL > Error establishing a database connection

Error establishing a database connection

If you get the message 'Error establishing a database connection' it usually means that your script failed to connect to the database.

Most common causes:
- Incorrect MySQL hostname. You must use "localhost" as your MySQL hostname.

- Incorrect MySQL username / password or database name.
You can find / setup the MySQL username and database by clicking on MySQL icon in the control panel.
You can also change the MySQL user password from here.
Make sure you use FULL database names and usernames, as shown in the MySQL page.

- You have not added MySQL user to the database. This is a very common procedure people forget to do. In order to have a fully operational MySQL database, you must also add a MySQL user to the MySQL database and assign full permissions.
You can achieve this by clicking the Add button under cPanel -> MySQL Databases -> Add User To Database section. If you are still unable to connect to MySQL you can try to confirm whether it is a problem with the server or with your script: if you can enter the phpMyadmin from the Members area that means everything is working fine on our side and it must be a problem with your PHP script.

Contact us and include as many details as you can about the problem and we will try to help you.