Service type
MySQL service
Self-hosted MySQL database service for applications that keep relational data inside the stack.
Use it in stacks that need repeatable data workflows, scheduled backups, and realistic environment refreshes without rebuilding those steps manually.
Why teams use this service
Technical profile
Review versions, ports, source, and packaging.
Stacks that use it
See where this service fits in ready-made stacks.
Backups and data import
Move working data between environments with storage-backed workflows.
Runtime wiring and defaults
See ports, links, storage, configs, and runtime behavior.
On Wodby
How MySQL runs on Wodby
Database, user and passwords
Wodby manages the database and its user; the application does not create them.
- One database and one user are created for the environment, both named after the application and the environment. The user is granted all privileges on that database only.
- The database uses
utf8mb4with the collationutf8mb4_0900_ai_ci. - The user's password and the
rootpassword are generated once per environment (tokenspasswordandroot_password). The container has the root password inMYSQL_ROOT_PASSWORD;rootmay connect from any host (MYSQL_ROOT_HOST). - Further databases and users are added on Wodby, which runs the same create and grant actions. A user created by hand with a name Wodby later needs, but another password, makes the create action fail rather than replace it.
How a linked service reaches it
- Host: the name of this app service inside the environment. Port:
3306. - A service linked to this one receives the host, port, database name, user name and password as environment variables defined by its own link (for example
DB_HOST,DB_PORT,DB_NAME,DB_USERNAME,DB_PASSWORDon the PHP service). Read those in the application; do not hardcode them and do not userootfrom the application.
Server configuration
The image is the official MySQL image with a Wodby entrypoint. On every start it writes /etc/mysql/conf.d/zz-wodby.cnf from the template /etc/gotpl/my.cnf.tmpl and environment variables. Two ways to change settings, neither of them editing the generated file:
- Set a variable on this service:
MYSQL_INNODB_BUFFER_POOL_SIZE,MYSQL_MAX_CONNECTIONS,MYSQL_MAX_ALLOWED_PACKET,MYSQL_WAIT_TIMEOUT,MYSQL_TRANSACTION_ISOLATION,MYSQL_CHARACTER_SET_SERVER,MYSQL_COLLATION_SERVER. These are written only when set:MYSQL_SQL_MODE,MYSQL_SLOW_QUERY_LOG,MYSQL_LONG_QUERY_TIME,MYSQL_PERFORMANCE_SCHEMA,MYSQL_INNODB_REDO_LOG_CAPACITY,MYSQL_INNODB_IO_CAPACITY,MYSQL_LOWER_CASE_TABLE_NAMES. - Override the service's config file
config("MySQL config"), which replaces the template itself, for a setting no variable covers.
A change applies with the next deployment of the service. The service runs a single instance.
Data, backups and imports
- Data is on the
datavolume, mounted at/var/lib/mysql. - The backup is a gzipped SQL dump of the environment's database. Tables listed in its "excluded table contents" option (names or
LIKEpatterns) keep their definition and lose their rows. - The database import replaces the data volume: the dump is loaded while a new, empty data directory is initialized. It accepts a
.sqlor.mysqlfile, or a.gz,.tar.gz,.tgzor.zipholding exactly one such file.
Check the result
In the database container:
mysql -uroot -p"$MYSQL_ROOT_PASSWORD" -e 'SHOW DATABASES;'lists the databases.mysql -uroot -p"$MYSQL_ROOT_PASSWORD" -e "SHOW VARIABLES LIKE 'max_connections';"shows a setting as the server runs it.
Overview
Technical profile and packaging
Versions
Source repository
Public Helm chart
Ports and protocols
Labels
Persistent volumes
Database workflows
Data workflows
Keep recovery points ready and move data between environments
Attach backups to the service model
Keep scheduled backup behavior with the same versioned service definition instead of rebuilding it environment by environment.
Refresh staging and development with working data
Import archives into another environment when teams need realistic copies for testing, review, or onboarding.
Upload archives to cloud storage
Send backup archives to external storage providers instead of keeping them only inside the platform.
Runtime wiring
Reuse connectivity, storage, and runtime defaults
Endpoints
Volumes
Configs
Database workflows