briqbriq
Dashboard

cookbook / mysql

MySQL

A MySQL database with a persistent volume.

Run it

briq_run({
  recipe: "mysql",
  params: {
    "version": "8.4",
    "database": "app",
    "size": "small"
  },
  wait: true
})

Parameters

NameTypeOptionsDefault
versionenum8.0, 8.4, 9"8.4"
databasestring"app"
sizeenumnano, small, medium, large"small"

Outputs

Returned by briq_run once the stack is healthy. Hosts resolve inside your team network; secrets are generated per run.

DATABASE_URL
mysql://root:<MYSQL_ROOT_PASSWORD>@mysql.<stack>.internal:3306/app
MYSQL_HOST
mysql.<stack>.internal
MYSQL_PORT
3306
MYSQL_USER
root
MYSQL_PASSWORD
<MYSQL_ROOT_PASSWORD>
MYSQL_DATABASE
app

What it runs

BriqImagePortsSizeVolume
mysqlmysql:8.43306small10 GB at /var/lib/mysql

When to use it

  • Your application targets MySQL or MariaDB and the migrations must be verified against the real dialect, not SQLite or Postgres.
  • A test suite expects DATABASE_URL in the mysql:// form.
  • You need a throwaway database that goes away on its own; the default TTL is 60 minutes.

The database parameter names the schema created at boot (default app). Versions 8.0, 8.4 (default) and 9 are available.

Tips

  • The healthcheck is slow on first boot. MySQL initialises its data directory the first time; wait: true can take 30 to 60 seconds. Later starts of the same briq are fast because the volume keeps the data.
  • Root only. The recipe exposes the root user with a generated password. Create application users with briq_exec and mysql -uroot -p$MYSQL_PASSWORD -e "create user …" if your tests need least privilege.
  • Import a dump with briq_files_put to /dump.sql, then briq_exec with sh -c "mysql -uroot -p$MYSQL_PASSWORD app < /dump.sql".
  • Not exposed publicly. Reach it from other briqs in the stack at mysql.<stack>.internal:3306.