PrestaShop makes use of a MySQL database to store product information and other settings for your online store. When installing or moving PrestaShop, there are database credentials that are needed in order for PrestaShop to establish a link to the database. Depending on whether you are performing a new install of PrestaShop, or moving an existing PrestaShop store to a new server, the steps to resolve a database connection error can vary. In this article, we will go through each scenario and guide you through resolving the Link to Database Cannot be Established eror in PrestaShop.

Link to Database Cannot be Established during PrestaShop Installation

If you see Link to database cannot be established when installing PrestaShop, this indicates an incorrect database setting. To resolve, review the following PrestaShop database settings and correct as needed:

Hostname: localhost
Database name: Make sure this is the full database name which will be prefixed with your cPanel user name(e.g. userna5_mydatabase)
Database username: Check to be sure you are using the database user assigned to the database, and not just the cPanel username (e.g. userna5_dbuser).
Password: This should be the password for the database user assigned to the database. You can change the database user's password, if needed.

When performing a new installation of PrestaShop, the first part of the process is to create a MySQL database and database user. Our tutorial on creating a MySQL database walks you through step-by-step, how to create the database and database user with the MySQL Database Wizard in cPanel. If you created your database without using the wizard, but didn't create a user and assign the user to your database, please see our tutorial on how to create and assign a user to a database.

Once you make any needed corrections to the database settings, you can continue with your new PrestaShop installation.

Link to Database Cannot be Established during PrestaShop Server Move

If you are seeing Link to Database Cannot be Established on a PrestaShop site that you moved to a new server, this indicates an error in the PrestaShop configuration file. When moving an existing installation of PrestaShop to a new server, there are several steps involved beyond just moving your site's files.

Once you have moved your PrestaShop site files, the next step is to create a MySQL database on the new server. Next, import your PrestaShop database into the new database. Finally, your PrestaShop configuration file will need to be updated with your new database credentials. The PrestaShop configuration file is named settings.inc.php and can be found inside the config folder of your PrestaShop directory.

You can easily update the PrestaShop configuration file using the cPanel File Manager. Once you have the file open for editing, the lines you will want to check and adjust as needed are the database name, database server, database user, and database password. Examples are as follows

define('_DB_NAME_', 'whhsup5_presta'); Replace the the DB_NAME value (enclosed with single quotes) with your new database name. On Web Hosting Hub servers the database name is prefixed with your cPanel user name.
define('_DB_SERVER_', 'localhost'); On Web Hosting Hub servers, you will want to make sure that the DB_SERVER value (enclosed with single quotes) is set to localhost
define('_DB_USER_', 'whhsup5_presta'); Replace the the DB_USER value (enclosed with single quotes) with your new database user. On Web Hosting Hub servers the database user is prefixed with your cPanel user name.
define('_DB_PASSWD_', 'yourpassword'); Replace the the DB_PASSWD value (enclosed with single quotes) with your new database password.

presta-config-db-settings

Once you have updated your PrestaShop configuration file with the correct database settings, refresh your website your browser and your PrestaShop site should appear.

Did you find this article helpful?

We value your feedback!

Why was this article not helpful? (Check all that apply)
The article is too difficult or too technical to follow.
There is a step or detail missing from the instructions.
The information is incorrect or out-of-date.
It does not resolve the question/problem I have.
How did you find this article?
Please tell us how we can improve this article:
Email Address
Name

new! - Enter your name and email address above and we will post your feedback in the comments on this page!

Did you find this article helpful?

Post a Comment

Name:
Email Address:
Phone Number:
Comment:
Submit

Please note: Your name and comment will be displayed, but we will not show your email address.

Related Questions

Here are a few questions related to this article that our customers have asked:
Ooops! It looks like there are no questions about this page.
Would you like to ask a question about this page? If so, click the button below!
Need More Help?

Help Center Search

Current Customers

Email: support@WebHostingHub.com Ticket: Submit a Support Ticket
Call: 757-416-6627 Chat: Click To Chat Now

Ask the Community

Get help with your questions from our community of like-minded hosting users and Web Hosting Hub Staff.

Not a Customer?

Get web hosting from a company that is here to help.
}