cookbook / mysql
MySQL
A MySQL database with a persistent volume.
- database
- sql
Run it
briq_run({
recipe: "mysql",
params: {
"version": "8.4",
"database": "app",
"size": "small"
},
wait: true
})briq run mysql
briq ls
briq logs -f <id>
briq rm <id>import { Briq } from '@briq/sdk';
const briq = new Briq(process.env.BRIQ_API_KEY);
const mysql = await briq.run({
recipe: 'mysql',
params: {
"version": "8.4",
"database": "app",
"size": "small"
},
});
console.log(mysql.outputs.DATABASE_URL);
// ... when done
await briq.destroy(mysql.id);Parameters
| Name | Type | Options | Default |
|---|---|---|---|
| version | enum | 8.0, 8.4, 9 | "8.4" |
| database | string | — | "app" |
| size | enum | nano, 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
| Briq | Image | Ports | Size | Volume |
|---|---|---|---|---|
| mysql | mysql:8.4 | 3306 | small | 10 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_URLin themysql://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: truecan 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_execandmysql -uroot -p$MYSQL_PASSWORD -e "create user …"if your tests need least privilege. - Import a dump with
briq_files_putto/dump.sql, thenbriq_execwithsh -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.