Skip to main content
Towbar’s mysql preset runs the reviewed MySQL 8.4 image on amd64 or arm64. It listens on port 3306, stores data in /var/lib/mysql, and verifies readiness with an authenticated mysqladmin ping.

Declare the resource

.towbar/resources/mysql.resource.yml
MYSQL_ROOT_PASSWORD is required by Towbar. The other three variables ask the image to create a named application database and non-root user on the first initialization. Use different values for the root and application passwords.

Connect from an app

Containers on the application network can reach mysql:3306. Store the application connection URL or individual fields in the app’s runtime secrets. The optional tunnel exposes server-local port 13306 only through SSH.

Initialization and credential changes

The initialization variables do not reconcile an existing data volume. Create, rename, or alter users and databases with SQL first. Update the corresponding Towbar values only after the database accepts the new credentials.

Back up and restore

Towbar uses mysqldump for a logical export and restores it with the MySQL client into a fresh target volume. Recovery requires MySQL major version 8. Continue with Database backups and Database restores.
Last modified on September 22, 2026