The WhatsApp Business API client requires MySQL to store data.

This document covers:

Switching to MySQL

If you are using our AWS template, or are already on MySQL, and can ignore this section.

Switching to MySQL requires stopping your WhatsApp Business API client, so plan for some downtime during this transition. Make sure you have the latest files and installation scripts from the Installation guide.

  1. While the Coreapp and Webapp are still running (or up), make a backup of the current settings and information. Save this backup.
  2. You need to put your MySQL credentials in a file. Create a file called mysql.conf with your MySQL credentials. Use the mysql.conf.DEFAULT file included in the installation scripts as a guide on what to provide; the values are all placeholders and need to be changed. The login for MySQL must have create database permissions because the WhatsApp Business API client will create the database and tables automatically.
  3. Run an updgrade and include the mysql.conf file you created in the previous step. It is recommended you upgrade and use the script for this step. If you do not want to upgrade at this time, you can set the version parameter to be your current WhatsApp Business API client version.
  4. Perform a restore the from the backup you made in the first step. This will move the settings and important encryption information to MySQL. If this restore stops the client, you will have to restart the Docker container using the command:
docker restart <your_container_id>

MySQL Environment Variables

You must set the database settings through environment variables when launching Docker images for both the Coreapp and Webapp.

If you used the scripts to install the WhatsApp Business API Client rather than the Docker Compose method, you must set the database settings through environment variables when launching Docker images for both the Coreapp and Webapp.

Database Setting Environment Variable













Setting the Environment Variables

Using a console, save your environment variables in a file:

cat env.list WA_DB_ENGINE=MYSQL WA_DB_HOSTNAME= WA_DB_PORT=3306 WA_DB_USERNAME=root WA_DB_PASSWORD=<your_password> WA_DB_CONNECTION_OPTION="SSL_KEY=/usr/local/ssl/client-key.pem;SSL_CERT=/usr/local/ssl/client-cert.pem;SSL_CA=/usr/local/ssl/ca.pem" WA_DB_NAME_PREFIX=<your_prefix>

Passing the Environment Variable File to Docker

Pass the file you created to Docker:

docker run -d --name wacore2.18.26 --env-file ./env.list -v whatsappData:/usr/local/waent/data -v whatsappMedia:/usr/local/wamedia whatsapp/coreapp:v2.18.26