Docs cipi.yml Web panel API MCP Guides Compare GitHub Telegram channel
  1. Docs
  2. Server & runtime
  3. Databases

Databases

MariaDB and PostgreSQL: create, back up, restore, rotate passwords.

Server & runtime

Each Laravel app gets its own database and user, so no app can read another's data. MariaDB is the default; PostgreSQL can be added and chosen per app or per database.

Databases
$ cipi db install pgsql
$ cipi db create --name=analytics --engine=pgsql

Engines#

bash
cipi db install pgsql             # add PostgreSQL next to MariaDB
cipi db default mariadb|pgsql     # default when --engine is omitted
cipi db engines
cipi db uninstall pgsql           # destroys its data: asks first
MariaDBPostgreSQL
Port3306 (localhost)5432 (localhost)
InstalledAlwayscipi db install pgsql
Laravel DB_CONNECTIONmysqlpgsql
Why choose itDesign decisionsDesign decisions

Databases#

bash
cipi db create --name=analytics --engine=pgsql
cipi db create --name=wpblog --app=blog     # belongs to the "blog" app
cipi db link wpblog blog                    # or link an existing one
cipi db list [--json]                       # sizes and owning app
cipi db backup myapp
cipi db restore myapp backup.sql.gz
cipi db password myapp                      # new password, .env updated
cipi db delete analytics

Each database has its own user and password. Linking is a label: a linked database is listed with its app (in the CLI and the panel) and is kept when the app is deleted; only a Laravel app's own database goes with it. Connect from TablePlus or DBeaver with the mariadb+ssh:// URL shown at creation: no database port is ever exposed.

Restores you can trust#

GuardEffect
Stops at the first failing statementClear error, exit 1, no "restored" lie
PostgreSQL restore in one transactionA truncated or failing dump rolls back; your data stays
Empty dumps refusedA backup of nothing never wipes a database
Newer pg_dump into older serverUnknown SET lines are dropped so it still restores
Files from an app's home opened as that userA malicious symlink can't make root read other files

Upgrades#

Database engines are excluded from unattended upgrades, so they never restart under you. Patch when you choose (brief restart):

bash
cipi db upgrade [mariadb|pgsql] [--yes]

Or schedule it with cipi autoupdate.

In the web panel#

Every database on every server, with backup, restore and password rotation. The web panel is optional; everything here also works from the CLI.

Common problems#

ProblemFix
Access denied for userPassword changed by hand: cipi db password myapp updates database and .env together
Restore stops with an errorCipi stops at the first failing statement: read it, fix the dump or the target
Can't connect from TablePlusUse the SSH tunnel settings (mariadb+ssh:// URL from creation); no database port is open

Questions#

QuestionAnswer
MariaDB or PostgreSQL?Both supported; see Laravel on PostgreSQL.
Can I open the database port?Avoid it; use SSH tunnels. If you must, allow one IP with cipi firewall allow 3306 --from=….
Need a copy without personal data?Anonymized dumps.