Chapter 06

Databases and Redis

MySQL and Redis run alongside your site on the internal network. You reach them by name, from inside your container, with no ports and no host addresses involved.

Your container no-app-example-com Connects outward by service name.
Database mysql:3306 MySQL 8.0, shared.
Cache and queues redis:6379 Redis 7, durable.

Connecting

The hostnames are literally mysql and redis. Neither publishes a port to the host, so they are unreachable from the public internet and from your laptop — only containers on the internal network can see them.

In a Laravel .env, that comes out as:

DB_CONNECTION=mysql
DB_HOST=mysql
DB_PORT=3306
DB_DATABASE=your_database
DB_USERNAME=your_user
DB_PASSWORD=your_password

REDIS_HOST=redis
REDIS_PORT=6379

The mysql and redis PHP extensions are both compiled into the image, so no further installation is needed.

You can edit these values, and the rest of your .env, straight from the panel: open your site and use the Environment tab. It shows the live .env exactly as stored; save your changes there, then restart the site so it reads them.

Create your database from the panel

Open your site and go to the Database tab, then Create database. The panel makes a MySQL database and a user for you — the name and username are derived from your domain, the password is generated — and shows you all four values (database, username, password, host). No need to ask your operator.

On a Laravel site you do not even have to copy them by hand: press Apply to .env and the panel writes the DB_* lines above straight into your .env, leaving everything else untouched. Then restart the site so it picks them up.

You can Reset password at any time, or Drop database to delete it — dropping asks you to confirm because it permanently destroys the data.

Redis is durable, not disposable

Redis is configured to persist to disk and — importantly — not to evict keys when memory fills up. When it runs out of memory, writes fail loudly instead of data silently disappearing.

That is a deliberate choice for queues and locks: a job quietly evicted from a queue is a job that never runs and never errors. The consequence for you is that Redis is not a throwaway cache you can fill without thinking. If you cache heavily, set expiry times on what you write. Unbounded, un-expiring writes will eventually cause failures rather than quietly making room.

It is shared with other sites, so key prefixes matter. Laravel's default cache and queue prefixes derive from your app name — set APP_NAME to something distinctive and you get separation for free.

phpMyAdmin

If your operator has published it, phpMyAdmin is available for browsing and editing your database in the browser. Sign in with the username and password from your site's Database tab — the same credentials the panel generated. It is intended for site owners, not just the operator, so it is reasonable to ask for the address.

It is always IP-locked

phpMyAdmin is permanently restricted to unlocked IP addresses. From anywhere else it returns a 403 with no explanation — the same bare refusal described in chapter 08. If you get one, unlock your IP address first, then reload.

What else is on the network

Your container can reach other containers by name, but there is nothing else you are expected to use. There is no shared object storage, mail relay, or search service provided by the platform. Anything else your app needs is an external service you configure yourself, reached over the internet as normal — outbound connections are not restricted.