# Databases

Source: https://docs.quake.ai/docs/databases
Markdown: https://docs.quake.ai/docs/databases.md
> Run PostgreSQL and MySQL/MariaDB on Quake AI: compute instances with a dedicated Block Storage data volume, private network access, and scheduled logical backups.

---

# Databases

Relational databases on Quake AI run on a compute instance you control. The engine (PostgreSQL, MySQL, or MariaDB) writes to a dedicated Block Storage volume, the instance sits on a private network, and a security group limits which addresses reach the database port. Quake AI provides the instance, the volume, and the network path; you choose the engine, the version, and the operating schedule.

Two OpenTofu templates compose those pieces for you: [Self-Managed PostgreSQL](/resources/iac-templates/self-managed-postgres) and [MySQL/MariaDB Database](/resources/iac-templates/mysql-database). Both provision the instance, format and mount the data volume, install the engine through cloud-init, create a starting database and role, and write a scheduled dump to the data volume.

## Get started

- [Deploy the self-managed PostgreSQL template with OpenTofu](/resources/deployments/deploy-self-managed-postgres-template): PostgreSQL 16 on a private subnet with a mounted data volume and a nightly `pg_dumpall`.
- [Deploy the MySQL/MariaDB database template with OpenTofu](/resources/deployments/deploy-mysql-database-template): MariaDB on a private subnet with a mounted data volume and a nightly `mysqldump`.
- [Deploy a database sandbox](/docs/quickstart/deploy-db-sandbox): install SQLite or PostgreSQL by hand on a single VM to prototype against.

## Choose a pattern

| Pattern | Use it when |
| --- | --- |
| [Self-Managed PostgreSQL](/resources/iac-templates/self-managed-postgres) | The workload speaks the PostgreSQL wire protocol and the database runs on its own instance. |
| [MySQL/MariaDB Database](/resources/iac-templates/mysql-database) | The workload speaks the MySQL wire protocol and the database runs on its own instance. |
| [WordPress + MySQL on Compute](/resources/iac-templates/wordpress-mysql) | WordPress and its MariaDB backend deploy together. |
| [Full-Stack Application](/resources/iac-templates/full-stack-app) | The database sits behind separate web and application tiers. |
| [Deploy a database sandbox](/docs/quickstart/deploy-db-sandbox) | You want a throwaway database on an existing VM without IaC. |

## How-to guides

<DocsSectionLinks section="databases/how-to" />

## Concepts

<DocsSectionLinks section="databases/concepts" grouping="concepts" primaryOnly />

## Migration

<DocsSectionLinks section="databases/migration" />

## Related services

A database deployment draws on four other services: [Compute](/docs/compute) runs the engine, [Block storage](/docs/block) holds the data directory, [Network](/docs/network) carries client traffic and enforces the security group, and [Object storage](/docs/object) holds dumps you copy off the instance. [Automation](/docs/automation) covers the OpenTofu workflow the database templates use.
