Skip to main content
The database is a fundamental part of the Evolution API v2, responsible for storing all the application’s critical information. The API supports both PostgreSQL and MySQL, using Prisma as the ORM (Object-Relational Mapping) to facilitate interaction with these databases.

Database Choice

Evolution API v2 offers the flexibility to choose between PostgreSQL and MySQL as the database provider. The choice can be configured through the DATABASE_PROVIDER environment variable, and connections are managed by Prisma.

Installation and Configuration

Using Docker

The easiest and fastest way to set up a database for Evolution API v2 is through Docker. Below are the instructions to configure both PostgreSQL and MySQL using Docker Compose.

PostgreSQL

To set up PostgreSQL via Docker, follow these steps:
  1. Download the docker-compose.yaml file for PostgreSQL available here.
  2. Navigate to the directory where the file was downloaded and run the command:
  1. The PostgreSQL instance will be available at localhost on port 5432.

MySQL

To set up MySQL via Docker, follow these steps:
  1. Download the docker-compose.yaml file for MySQL available here.
  2. Navigate to the directory where the file was downloaded and run the command:
  1. The MySQL instance will be available at localhost on port 3306.

Environment Variables Configuration

After setting up the database, define the following environment variables in your .env file:

Local Installation

If you prefer to set up the database locally without using Docker, follow the instructions below:

PostgreSQL

  1. Install PostgreSQL on your machine. On Ubuntu-based systems, for example, you can use:
  1. Start the PostgreSQL service:
  1. Create a database for Evolution API v2:

MySQL

  1. Install MySQL on your machine. On Ubuntu-based systems, you can use:
  1. Start the MySQL service:
  1. Create a database for Evolution API v2: