Skip to content
PortBay

Per-project databases, provisioned in one click

Pick an engine, name the instance, click Create. PortBay initialises an isolated data directory, allocates a port, supervises the process, and injects the connection into your project on every start.

The short answer

How do I run a separate local database for each project on a Mac?

Per-project isolation means each database gets its own data directory, its own port and its own config file, instead of one global Homebrew daemon on :3306 that every project's migrations collide inside. By hand that is mysqld --initialize-insecure --datadir ~/db/blog, a port you have to remember, a DATABASE_URL line in .env, and something to bring it all back after a reboot — repeated per project. PortBay provisions and supervises those instances for six engines: MySQL, MariaDB, PostgreSQL, Redis, MongoDB and Memcached, each run under Process Compose, the same supervision layer as your dev servers. Link one to a project and DATABASE_URL, DB_CONNECTION, DB_HOST, DB_PORT, DB_USERNAME and DB_PASSWORD are injected into the project's process on every start, with your own env values still winning. A Client button opens mysql, psql, mongosh or redis-cli already pointed at the instance.

Verified against the product, 2026-07-10.

In the app

Provisioned, wired, supervised

PortBay — Services
acme_shop Provisioning…
# .env
waiting for database…
Mailpit0
Inbox empty — every outgoing email lands here.

An instance is created with its own data directory and port, the connection variables reach the linked project, and captured mail shows the services panel working as one.

How it works

From engine to connected app

  1. Add a database
  2. Link it to a project
  3. Open a client when you need SQL
  4. Let supervision do the babysitting
  5. Remove without losing data

Add a database

Pick an engine, name the instance, optionally choose a port (auto-allocated otherwise). First-time MySQL and PostgreSQL initialisation runs in the background and can take a minute or two.

mysql://[email protected]:3306/

Link it to a project

On the project's next start, PortBay injects DATABASE_URL, DB_CONNECTION, DB_HOST, DB_PORT, DB_USERNAME and DB_PASSWORD into its process. Your per-project env overrides always win, and unlinking is one click.

Open a client when you need SQL

The Client button resolves the engine's CLI and opens it in your terminal, preconfigured for the instance's port.

psql -U postgres -h 127.0.0.1 -p 5432 postgres

Let supervision do the babysitting

Start, stop and restart from the detail panel with live status. Auto-start brings the instances you rely on up with the app.

Remove without losing data

Deregister-only stops the daemon and keeps the data directory, so re-adding the instance later reuses it. Delete removes the data too, and says so before it does.

Spec

Databases, tier by tier

CapabilityCommunityPro
EnginesAll 6All 6

MySQL, MariaDB, PostgreSQL, Redis, MongoDB, Memcached.

Isolated data directory + config per instanceIncludedIncluded
Connection vars injected on project startIncludedIncluded
Auto-start with the appIncludedIncluded
Projects to link againstUp to 6Unlimited

Engine binaries install once per engine via Homebrew; the wizard shows the command when one is missing.

Without PortBay

One shared Homebrew MySQL for everything

The manual route is a single global daemon every project fights over, or a hand-rolled data directory and port per project that you must remember to wire in.

PortBay keeps each instance isolated and supervised, and the connection variables arrive on every start instead of living in a stale .env.

Questions

Asked before downloading

Which database engines does PortBay manage?

MySQL, MariaDB, PostgreSQL, Redis, MongoDB and Memcached. Each instance gets an isolated data directory, an engine-specific config file and a dedicated port, and the version is detected from the daemon binary at create time.

How does my app get database connection details from PortBay?

Link the instance to the project. On every PortBay-managed start, DATABASE_URL, DB_CONNECTION, DB_HOST, DB_PORT, DB_USERNAME and DB_PASSWORD are injected into the project's process. They are not written into your .env file, and your own per-project env values override them.

Do I need to install a database engine before PortBay can provision one?

The engine's binary, once per engine, via Homebrew (for example brew install mysql or brew install postgresql@16). The Add Database wizard detects a missing binary and shows the exact install command.

Can two projects each have their own MySQL?

Yes. Create one instance per project: each gets its own data directory, config and port, so migrations and data never collide. MySQL and MariaDB can even coexist; whichever is added second is auto-allocated a different port.

What happens to my data when I remove a PortBay database instance?

Your choice, stated in the dialog: deregister-only keeps the data directory on disk so re-adding the instance later reuses it, while delete-and-deregister removes the data too and is irreversible.

PortBay mascot — a friendly blue tugboat

Give your projects and your agents a real local home.

Download for macOS

Free & open source · macOS 11+ on Apple Silicon · Pro from $10/mo