Database service
Services/MariaDB

MariaDB service

Self-hosted MariaDB database service for applications that keep relational data inside the stack.

You add this service to a stack, where you choose its version and resources. Each app environment can override them.

On Wodby

How MariaDB runs on Wodby

What Wodby and the image set up for this database service. Check it before creating databases or users by hand, or adding connection settings to an application.

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 is created with the charset and collation chosen for it on Wodby (utf8mb4 by default).
  • The user's password and the root password are generated once per environment (tokens password and root_password). The container has the root password in MYSQL_ROOT_PASSWORD.
  • 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_PASSWORD on the PHP service). Read those in the application; do not hardcode them and do not use root from the application.

Server configuration

The container writes /etc/mysql/my.cnf on every start from environment variables. Change a setting by setting the variable on this service, not by editing the file. The ones used most:

  • MYSQL_INNODB_BUFFER_POOL_SIZE, MYSQL_MAX_CONNECTIONS, MYSQL_MAX_ALLOWED_PACKET
  • MYSQL_CHARACTER_SET_SERVER, MYSQL_COLLATION_SERVER
  • MYSQL_WAIT_TIMEOUT, MYSQL_INNODB_LOCK_WAIT_TIMEOUT, MYSQL_TRANSACTION_ISOLATION
  • MYSQL_SLOW_QUERY_LOG, MYSQL_LONG_QUERY_TIME, MYSQL_GENERAL_LOG

A change applies with the next deployment of the service. Host names are not resolved (skip-name-resolve), and the client character set handshake is skipped: connections use the server character set.

Data, backups and imports

  • Data is on the data volume, mounted at /var/lib/mysql.
  • The backup is a gzipped SQL dump of the environment's database made with mariadb-dump --single-transaction. Tables listed in its "excluded table contents" option (names or LIKE patterns) 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 .gz, .tar.gz, .tgz and .zip holding exactly one .sql or .mysql file.
  • After a version upgrade Wodby runs mariadb-upgrade and mariadb-check on the environment's database and on the mysql system database.

Check the result

In the database container:

  • mariadb -uroot -p"$MYSQL_ROOT_PASSWORD" -e 'SHOW DATABASES;' lists the databases.
  • mariadb -uroot -p"$MYSQL_ROOT_PASSWORD" -e "SHOW VARIABLES LIKE 'max_connections';" shows a setting as the server runs it.

Overview

Technical profile of MariaDB

The versions are the ones you can select for MariaDB in a stack or an app environment. The service itself is published in revisions, and a stack references a specific revision.

Service type

Database service

Versions

12.3, 11.8, 11.4

Persistent volumes

Data

Stacks

Stacks that include MariaDB

These public stacks include MariaDB. You can create an app from a public stack as it is, or add the service to a stack of your own.

Data

Backups and data import for MariaDB

The MariaDB service defines how its data is backed up and imported. You run a backup or an import from the app environment that the service belongs to.

Manual and scheduled backups

Run a backup when you need one, or set a schedule in a backup preset.

Import from an archive, a URL, or a backup

An import takes an uploaded archive, a public URL, or a completed backup of a compatible service.

Where archives are stored

Wodby writes each archive to Wodby Blob Storage or to a bucket at a storage provider that you connect as an integration.

Configuration

MariaDB service configuration

The MariaDB service declares the following. Where a value can be changed, a stack sets it and each app environment can override it.

Volumes

Data

Actions

3 actions. An action is a command that you run from the dashboard or that Wodby runs after a deployment or a stack upgrade.

Related databases

Related database services

This database service belongs to the same family as MariaDB. The link opens its database page.