Skip to content

Host a MySQL database

Two ways to do this on MicroApps: a managed database pod, or rolling your own inside a regular pod.

Option A - managed database pod

  1. Pods → New
  2. Workload: MySQL
  3. Version: 8.0
  4. Compute: Small (1 vCPU, 1 GB RAM) is fine for most small apps
  5. Storage: Small (10 GB) - pick larger if you'll be storing more
  6. Region: nearest to your app pod
  7. Network: attach the same private network as your app pod (recommended)
  8. Create Pod

Once it's up, open the Connection Strings tab on the pod. You'll see:

  • Public hostname and the external port mapped to MySQL (e.g. 3308 → internal 3306)
  • Private hostname (used from the same network)
  • User: root
  • Password: generated for you and shown at creation. Lost it? Click Reset password on the pod (database pods only) and you'll get a fresh one.

If your app pod is on the same private network, use the private hostname and internal port directly:

bash
mysql -h db-pod -P 3306 -u root -p

db-pod is the database pod's private hostname (shown in the Connection Strings tab). Port 3306 works because same-network peers reach each other on internal ports.

Connecting from the public internet

Use the public hostname and the external port from the Connection Strings tab:

bash
mysql -h your-db.microapps.io -P 3308 -u root -p

(Replace your-db.microapps.io and 3308 with the values shown in your Connection Strings tab.)

Lock it down

Public access is convenient but risky. Put your app pod and database pod on the same private network, and attach a firewall that allow-lists only IPs you trust. Firewall rules are per-IP and cover every public port, so everyone else loses the MySQL external port (and everything else) in one go - while your app pod keeps reaching the database over the private network, which doesn't pass through the firewall.

Option B - install MySQL manually

If you want full control:

  1. Create a regular Ubuntu pod (Small or larger).
  2. SSH in (use the external port from the Connection Strings tab):
    bash
    ssh -p 3001 ubuntu@your-pod.microapps.io
  3. Install MySQL:
    bash
    sudo apt update
    sudo apt install -y mysql-server
    sudo mysql_secure_installation
  4. Bind to the IPs you want in /etc/mysql/mysql.conf.d/mysqld.cnf.
  5. Create users and databases as usual.
  6. An Ubuntu pod's only public mapping is SSH, so MySQL is not directly reachable from the internet - which for a database is a feature. Reach it from other pods on the same network via the private hostname and 3306, or from your laptop through an SSH tunnel: ssh -p <external-port> -L 3306:localhost:3306 ubuntu@<public-host>.
  7. Lock down SSH access with a firewall.

Keep a safety net

Either way, turn on an automatic snapshot schedule so you always have a recent rollback point:

http
PUT /api/pods/:id/snapshot-schedule
{ "schedule": "daily" }

schedule is "", "daily", "weekly", or "monthly" - all at 3:00 AM UTC, rotated automatically. Snapshots rewind the pod in place. For a copy that restores as a separate pod (proper disaster recovery), also set a backup schedule. See Schedule nightly snapshots.

Built for the long tail.