Databases

CloudSonic servers ship with MariaDB and PostgreSQL pre-installed and tuned for production workloads. Both run on localhost only -- your application connects internally, never over the public internet.

This section covers everything you need to create and manage databases on your server, from spinning up a new database in 30 seconds to running raw queries, importing dumps, and understanding when to reach for each database engine.

What's installed

Every CloudSonic server provisioned with the standard stack gets:

Database Port Use case
MariaDB 3306 WordPress, PHP apps, relational data
PostgreSQL 5432 (via PgBouncer) APIs, complex queries, time-series, modern apps

PostgreSQL runs on port 5433 internally. PgBouncer sits in front of it on port 5432 and pools connections so your app never exhausts the database's connection limit. Your app always connects to 127.0.0.1:5432 -- you don't need to think about this distinction.

Choosing a database

Use MariaDB when:

  • You're running WordPress or a PHP CMS
  • Your team is more familiar with MySQL-style SQL
  • You want the simplest possible setup

Use PostgreSQL when:

  • You're building an API or modern web app (Next.js, Laravel, Django, Rails)
  • You need JSON storage, full-text search, or advanced indexing
  • You're storing time-series data (metrics, events, logs) via TimescaleDB
  • You want richer data types: arrays, enums, ranges, UUIDs natively

Use both: there's nothing stopping you running WordPress on MariaDB and your API on PostgreSQL on the same server. They don't interfere with each other.

Where credentials are stored

Root/superuser credentials are stored on the server and never shown in the CloudSonic dashboard:

# MariaDB root password
sudo cat /etc/mariadb/root.conf

# PostgreSQL superuser password
sudo cat /etc/postgresql/superuser.conf

Per-database credentials are saved when you create a database:

# MariaDB
cat /etc/mariadb/databases/myapp.conf

# PostgreSQL
cat /etc/postgresql/databases/myapp.conf
Note These files are readable by root and www-data only. Your application running as www-data can read its own credentials directly from these files rather than hardcoding passwords in config files.

Managed Databases

If you'd rather not manage your own database server, CloudSonic offers fully managed databases with automatic backups, 3-node replication, and zero maintenance on your end. See the Managed Databases page.