How to set up the database in Prestashop

How to set up the database in Prestashop

PrestaShop is a popular e-commerce platform that allows you to create and manage your online stores effectively. A fundamental part of PrestaShop configuration is the correct database setup. The database stores critical information about products, customers, orders, and more. Therefore, it is crucial to ensure it is configured correctly to guarantee optimal performance of your online store. 

In this guide, we will show how to configure your PrestaShop database and the necessary steps to do so. 

The PrestaShop database configuration is based on a file within your web installation that establishes the connection with the database, where you must specify the database username, password, host name, and the database name. Once connected to your database, PrestaShop recognizes all the tables used in your installation. 


These details are vital for PrestaShop to function and can be modified from the hosting files via FTP. This process applies to PrestaShop installations that already have a database created. If it is a completely new database, the process is exactly the same, but you will need to import the necessary content into the new database. 


Below, we will explain how to modify the configuration file depending on the PrestaShop version you have installed: 

To make these changes, you must access your hosting files. We recommend making the change using our webFTP tool.

Note: The website files are located inside the /web folder. If PrestaShop is installed inside a specific folder, you must access that folder.

Configure PrestaShop 1.7 Database 

Configuration File Location: /web/app/config/parameters.php 

In this file, you must edit the following lines to configure your database: 

define('_DB_SERVER_', localhost);
define('_DB_NAME_', 'your_database_name');
define('_DB_USER_', 'your_MySQL_username');
define('_DB_PASSWD_', 'your_MySQL_user_password'); 

Save the changes in the file to complete the configuration.

Configure PrestaShop 1.6 Database 

Configuration File Location: /web/config/settings.inc.php 

To configure the database connection, locate and modify the following constants: 

define('_DB_SERVER_', 'localhost');
define('_DB_NAME_', 'your_database_name');
define('_DB_USER_', 'your_MySQL_username');
define('_DB_PASSWD_', 'your_MySQL_user_password'); 

IMPORTANT: You must replace the text “DB_NAME” with the name of the database you created in the hosting panel. You must also replace “DB_USER” and “DB_PASSWD” with your hosting MySQL username and password, respectively. 

By following these steps, your PrestaShop will be correctly configured to point to the database created in your hosting, as long as all the provided data (host name, database name, username, and password) are entered correctly. Please note that database configuration is usually performed only once and does not require frequent modifications.

 

 
For more information, you can contact us.
    • Related Articles

    • How to change the Prestashop administrator user password (Backoffice)

      From the PrestaShop database, you can manually modify the PrestaShop administrator password (also known as Back Office) without needing to log into the admin panel itself. To do this, the first step is to obtain the cookie_key of your PrestaShop in ...
    • .htaccess default from PrestaShop

      The .htaccess file is a configuration file used on Apache-based web servers. It is used to control and configure the behavior of a website. The .htaccess file has multiple functions and allows you to customize a website’s configuration in a specific ...
    • How to modify the associated domain of the Prestashop

      When we modify the site of our PrestaShop installation, the website loads incorrectly, the template or stylesheet does not load, we cannot access the admin panel, etc. This happens because, at the time of installing our PrestaShop, the current path ...
    • How to modify the domain and/or folder associated with Prestashop

      When we modify the site of our PrestaShop installation, the store may stop working. This happens because, at the time of installing PrestaShop, the current path is stored. To modify the paths of our installation, we must manage the PrestaShop ...
    • How to reset/delete prestashop cache

      Cache is a feature used by PrestaShop to temporarily store data and resources, which significantly improves the loading speed of your online store. However, as you make changes to the site, such as modifying the design, products, or categories, it ...