Deploying a Prestashop ecommerce: the cloud friendly way — Part 3 — Database 🗄

Set up the database for Prestashop.

Pol Guixé
Origen Studio
3 min readApr 5, 2017

--

This article is a continuation of Deploying a Prestashop ecommerce: the cloud friendly way — Part 2

Once the server is configured the next step is to set-up de DB. In this serie of article we want to a cloud friendly Prestashop deployment. Hence the computing part — the current server — should be decoupled from the database. However let’s quickly remember how we would set-up a database inside our server, like in a “normal” Prestashop deployment.

Reminder on the “normal” way of creating and configuring a DB for Prestashop

Once connected to your server, log into the MySQL Shell as root:

mysql -u root -p

Once successful login to the MySQL shell. Now, create database for prestashop. We will call it prestashoptest:

CREATE DATABASE prestashoptest;

Next, you need to create a user that the Prestashop application can use to connect to the database. In this tutorial, we’ll call our user prestashopuser, use the password that you prefer:

CREATE USER prestashopuser@localhost IDENTIFIED BY 'prestashoppsswd';

Now, you have a database and a user for prestashop installation, but these two components have no relationship yet. The user has no access to the database. Fix it by granting the user account access to your database with the following command:

GRANT ALL PRIVILEGES ON prestashoptest.* TO prestashopuser@localhost;

Now the user has access to the database. We need to flush the privileges to tell mysql to reload the user table:

FLUSH PRIVILEGES;

Now sign out from MySQL shell:

exit;

Now we have a DB and user that we can specify during the Prestashop installation.

But in this series of articles we want to deploy Prestashop in a cloud friendly way. Hence let’s setup and external DB.

Set up an external DB

You can use any MySQL compatible — MariaDB, Aurora, etc. — database with Prestashop. AWS RDS offer you a wide variaty of DBs and configurations to suit your needs.

AWS RDS Engine options

When you create a database in AWS RDS, make sure:

  1. You add it in the same VPC as the EC2 instance.
  2. Add a security group with the right ports and sources. See above. The same grup should also be added to the EC2 instance.
  3. Remember DB name, username, password, endpoint and port.
Make sure you select the same VPC and security group as in your EC2 node. Remember all the other details such as DB name, username, password, etc. You’ll need later.

Cool! Your external DB should be up and running now. Just to recap, we have:

  1. Created an EC2 Ubuntu 14.04 server
  2. Configure it for Prestashop with its dependencies
  3. Created and external DB that we will link during installation

Next step is to set-up and external file system for our Prestashop media files

See Deploying a Prestashop ecommerce: the cloud friendly way — Part 4

If you want to use the file system in your server just skip Part 4 and go to Part 5

--

--

Pol Guixé
Origen Studio

Aerospace engineer working on software development.☺️ Building great products at @theorigenstudio. 🍕and 🚵‍♂️⛷ passionate