Skip to main content
Version: 8.6.x

MySQL Container

A containerized MySQL database implementation that is suitable for development and test environments. The container entrypoint script will create the necessary database user, create a database, and grant the user all permissions on the created database.

Prerequisites​

The mysql container image must be built and available. For information on building container images, see Building Container Images.

Suitable Environment Types​

The MySQL database implementation is suitable for development and test environments. The data is stored in the container and can disappear if the container is replaced. Database backup and restore tools are not supported.

Include in Development and QA Environments?Include in Authoring Environments?Include in Live Environments?
YesNoNo

Configuration​

The sections below describe typical configurations.

Note about production sizing and tuning​

The values shared in this document are suggestions that are known to work well in typical scenarios.

Resource allocation​

Resource allocation can vary by usage and load. Below are typical values.

ResourceNon ProductionProduction Like (See Note)
Container Memory (MB)768N/A
Container Cores0.25N/A
Java Heap (MB)N/AN/A

Scaling and replicas​

This service is stateful and should not be scaled to maintain a consistent user experience.

ConfigurationNon ProductionProduction Like (See Note)
Minimum Replicas1N/A
Maximum Replicas1N/A
Max Surge (%)25N/A
Max Unavailable (%)25N/A

Ports​

PortNon ProductionProductionPurposeComment
3306YesN/AJDBC port, allowing connectivity to the database.This port should only be exposed internally, ideally only to the Commerce services that access the database.
8180YesN/AHealth and liveness checks.This port should only be exposed internally, ideally only to the container orchestrator.
8888OptionalN/AJMXThe container listens on this port when the ENABLE_JMX environment variable is set to true. This port should only be exposed internally to users and tools that require access to JMX data.
1081OptionalN/AJava debuggerThe container will listen on this port when the ENABLE_DEBUG environment variable is set to true. This port should only be exposed internally, to developers who debug Java application code. This port is typically not open in production.

Health, Liveness and Readiness​

The MySQL command below is recommended for the container healthcheck.

mysql --defaults-file=/var/lib/mysql/healthcheck_cf -uhealthcheck -e "select User from mysql.user;"

Volumes​

The MySQL container does not have specific support or recommendations for volumes.

Environment Variables​

The MySQL service is configured using container environment variables. Some environment variables must be set and some are optional. The environment variables are read and consumed by the container entrypoint scripts. The supported environment variables for this service are shown in the following table.

Variable NameDescriptionRequired
MYSQL_ROOT_PASSWORDThe password to use for the MySQL database root user.Yes
MYSQL_DATABASEThe name of the database to create and use.Yes
MYSQL_USERThe user name for the MySQL database user that will be created.Yes
MYSQL_PASSWORDThe password for the MySQL database user that will be created.Yes
important

The entrypoint scripts are and will remain the source of truth on the required environment variables. Review the container entrypoint scripts in your selected release to validate the required variables.