---
url: https://docs.zenavo.app/deploy/databases
---

# Databases

**Add Service** → **Databases** lists PostgreSQL, MySQL, MariaDB, MongoDB, Redis and Valkey. Pick a version on the row and click it (or press <kbd>Enter</kbd>): the database is added and deployed.

| Database | Versions | Data volume |
|---|---|---|
| PostgreSQL | 18, 17, 16, 15, 14 | `/var/lib/postgresql` (18+) or `/var/lib/postgresql/data` |
| MySQL | 8.4 LTS, 9, 8.0 | `/var/lib/mysql` |
| MariaDB | 11.8 LTS, 11.4 LTS, 10.11 LTS | `/var/lib/mysql` |
| MongoDB | 8.0, 7.0, 6.0 | `/data/db` |
| Redis | 8, 7.4, 7.2 | `/data` |
| Valkey | 8, 7.2 | `/data` |

Each database gets a volume for its data, a generated password and a health check. The major version stays fixed: upgrading later needs a dump and restore.

## Connect from your app

Other services in the project reach the database at `<hostname>.zenavo.internal` and receive these variables, named after the database's [private hostname](https://docs.zenavo.app/networking/private) when it was added (`postgresql` → `POSTGRESQL_…`, `postgresql-2` → `POSTGRESQL_2_…`). Their host part is `${CONTAINER_HOSTNAME}`, so it follows a later hostname change:

| Variable | Example |
|---|---|
| `<NAME>_CONNECTION_STRING` | `postgresql://postgres:…@postgresql.zenavo.internal:5432/zenavo` |
| `<NAME>_HOST` | `postgresql.zenavo.internal` |
| `<NAME>_PORT` | `5432` |
| `<NAME>_DB_PASSWORD` | the generated password |

The database is private to the project. To reach it from your computer, publish a TCP port under **Networking** ([TCP & UDP Ports](https://docs.zenavo.app/networking/tcp-udp)) or use the service's **Command** panel.

## Database view

A database service's **Database** tab shows its data and runs requests inside the database container with the database's own client, connected over the container's local socket or `127.0.0.1` with the credentials from the service's variables. The database port is not opened for this, the credentials never reach the browser, and nothing you type passes through a shell.

| | |
|---|---|
| Who can see data | Team members, admins and owners. Viewers cannot see data. |
| Who can change data | Team admins and owners. |
| Limits | 15 seconds, 2 MB of output and two requests at a time per database. Longer results are cut and marked as such. |
| Audit log | Every listing, page, query and command is recorded in the team's [audit log](https://docs.zenavo.app/account/audit-log) with the service and what kind of request it was, never the SQL, keys, values, filters or documents, which may contain secrets. |

The client runs as the database's administrative user, and team members can already open a shell in the container from the **Command** panel, so the view's read-only mode guards against accidental changes; it is not a sandbox. Use database users with fewer privileges for anything that needs stricter separation.

### PostgreSQL, MySQL and MariaDB

The tab first lists every database on the server with its number of tables (and schemas, for PostgreSQL); the one the service's variables name is marked **Service database**. Click one to open it: tables, rows and SQL then run in that database, and **Databases** goes back to the list. Team admins can **Create database**: names use letters, digits, `_`, `$` and `-` and start with a letter or underscore. A database whose name uses other characters is listed but not opened. MySQL and MariaDB leave out their system databases (`mysql`, `information_schema`, `performance_schema`, `sys`); PostgreSQL leaves out its templates.

The tab lists tables and views with estimated row counts and columns (primary keys are marked). Click a table to page through its rows, 100 at a time, or switch to **SQL** to run a statement and see the result as a table. Press <kbd>⌘</kbd> <kbd>Enter</kbd> (<kbd>Ctrl</kbd> <kbd>Enter</kbd>) to run it; with text selected, only the selection runs. Queries use `psql`, or `mysql` / `mariadb`.

| | |
|---|---|
| Read-only by default | Statements run in a read-only transaction, and only `SELECT`, `WITH`, `SHOW`, `EXPLAIN` and `DESCRIBE` are accepted. |
| Writes | A team admin or owner turns on **Allow writes** for `INSERT`, `UPDATE`, `DELETE` and schema changes. They take effect immediately; take a [backup](https://docs.zenavo.app/operations/backups) first. |
| One statement at a time | Scripts with several statements, client commands (`\!`, `source`, `system`, …) and MySQL executable comments (`/*! … */`) are refused. |
| Limits | A 15 second statement timeout and 1,000 rows per query. |

### Redis and Valkey

The header shows the server at a glance: version, memory used (and the `maxmemory` limit, if set), the number of keys and connected clients. **Keys** lists keys with their type, time to live and memory size, grouped into folders by `:` the way Redis tools show them: `user:1:profile` is under `user` › `1`, and each folder shows how many keys it holds. Switch to a flat list with the button next to the database picker. Pick the database (databases with keys come first, with their key counts; the other 16 are listed as empty) and type a match pattern such as `user:*`. Keys are listed with `SCAN`, 200 at a time, never with `KEYS`, which blocks the server on large databases; **Scan more** continues. Click a key to see its value:

| Type | Shown as |
|---|---|
| string | The value, up to 256 KB |
| hash | Fields and values, 100 at a time (`HSCAN`) |
| list | Items with their index, 100 at a time |
| set | Members, 100 at a time (`SSCAN`) |
| sorted set | Members and scores in order, 100 at a time |
| stream | Entries with their fields, 100 at a time |

Elements are cut at 4 KB. A string can be shown as text, as formatted JSON (chosen by default when the value is a JSON object or array) or as a hex dump; bytes that are not text are shown as `\xHH`. Module types (JSON, time series, …) show their type and size; read them with their own commands.

**Console** works like `redis-cli`: type a command at the `127.0.0.1:6379>` prompt (`127.0.0.1:6379[2]>` in `db2`) and press <kbd>Enter</kbd>. Commands and replies stay in the scrollback, formatted as `redis-cli` prints them; <kbd>↑</kbd> and <kbd>↓</kbd> go through earlier commands, and <kbd>Ctrl</kbd>+<kbd>L</kbd> or **Clear** empties it. One command runs at a time, quoted like `redis-cli`: `SET "my key" "a value"`. Commands use `redis-cli` or `valkey-cli` with the password from `REDIS_PASSWORD` or `VALKEY_PASSWORD`.

| | |
|---|---|
| Read-only by default | Only commands that read are accepted: `GET`, `HGETALL`, `LRANGE`, `SCAN`, `TTL`, `INFO`, … |
| Writes | A team admin or owner turns on **Allow writes** for commands that change keys and values: `SET`, `DEL`, `EXPIRE`, `HSET`, `LPUSH`, `ZADD`, `XADD`, … They take effect immediately. |
| Always refused | Commands that affect the whole server or other clients: `FLUSHALL`, `FLUSHDB`, `SWAPDB`, `CONFIG`, `SHUTDOWN`, `DEBUG`, `MODULE`, `ACL`, `CLIENT`, `MONITOR`, `SLOWLOG`, `REPLICAOF` / `SLAVEOF`, `MIGRATE`, `SAVE`, `BGSAVE`, `CLUSTER`, `FAILOVER`; `KEYS`; scripts (`EVAL`, `EVALSHA`, `SCRIPT`, `FUNCTION`, `FCALL`); blocking commands (`BLPOP`, `XREAD … BLOCK`, `WAIT`, …); pub/sub, transactions (`MULTI`, `WATCH`) and `SELECT`. Commands the view does not know are refused too. |

For anything else, run `redis-cli` or `valkey-cli` from the **Command** panel.

### MongoDB

The tab lists databases and their collections with estimated document counts (`admin`, `config` and `local` appear under **System databases**). Click a collection and enter a filter, a sort and a projection as JSON, such as `{"status": "active"}`, `{"created": -1}` and `{"name": 1}`; press <kbd>Enter</kbd> to find. Documents are shown 50 at a time as relaxed [Extended JSON](https://www.mongodb.com/docs/manual/reference/mongodb-extended-json/): `{"$oid": "…"}` for object IDs, `{"$date": "…"}` for dates, and `{"$numberLong": "…"}` for 64-bit integers a JavaScript number cannot hold exactly. Use the same forms in filters. Requests use `mongosh`, signed in with `MONGO_INITDB_ROOT_USERNAME` and `MONGO_INITDB_ROOT_PASSWORD`.

| | |
|---|---|
| Find | A filter, sort and projection of up to 64 KB each; at most 500 documents per page. Documents over 256 KB show only their `_id`; use a projection to see part of them. |
| Changes | Team admins and owners can **Insert** a document, and update or delete one document at a time, matched by its `_id`. Updates use operators (`$set`, `$unset`, `$inc`, …); replacing a whole document is not supported. System collections cannot be changed. |
| Refused | Operators that run JavaScript on the server (`$where`, `$function`, `$accumulator`). There is no aggregation and no `runCommand`; use `mongosh` from the **Command** panel for those. |
