Skip to content
Docs

MySQL and MariaDB

Shared MySQL for small sites, or your own MySQL 8.4 or MariaDB 11.8 with memory and processor limits you set. Laravel and WordPress connect by themselves.

Updated 17 Oct 20263 min read

You can run MySQL 8.4 shared or as its own database, and MariaDB 11.8 as its own database. Both are for the PHP world: Laravel, WordPress and most PHP apps. Pick MySQL unless your app asks for MariaDB.

Shared MySQL or its own

Shared MySQLreading today's prices

  • each user may keep up to 30 connections open;

  • any query is stopped after 30 seconds.

That's plenty for a blog, a small shop or a site with a few hundred visitors a day. Your database is still yours alone: it has its own database and user, other customers can't see it, and only your project's apps can reach it. Storage is never capped.

Its own MySQL or MariaDB has its own memory and processor, with limits you set. It pays for the memory and processor it really uses, every hour, and has no fair-use guards. Pick it when the shop is busy, when you run long reports, or when queries take more than 30 seconds.

Shared MySQLOwn MySQLOwn MariaDB
Version today8.48.411.8
Connections30 per userSet by its memorySet by its memory
Longest query30 secondsNo limitNo limit
Lowest memoryNone to set512 MB512 MB
Extra usersYesYesYes

Add one

  1. Open your project's Overview, and under Add a service choose Database.

  2. Choose MySQL or MariaDB.

  3. For MySQL, choose Shared or Its own under Where it runs. For its own, set the memory and processor limits with the sliders.

  4. Keep or change the name: lowercase letters, numbers and dashes.

  5. Tick the apps that should get its connection details, then choose Add.

It's ready in about a minute.

Example: Asha's shop

Asha starts duka with a shared MySQL named mysql. Her Laravel app web gets these variables, among others:

Terminal
DB_CONNECTION=mysql
DB_HOST=mysql.duka.internal
DB_PORT=3306

Her shared database's name and user start with t and twelve letters and digits, because the shared MySQL holds many customers' databases. When duka gets busy, she adds her own MySQL, imports a copy of the shared one, attaches the new one to web and detaches the old one. An own database's main user and database name are db_ and the project's name: db_duka.

For MariaDB, DB_CONNECTION is mariadb, which Laravel 11 and newer know. On an older Laravel, set your config/database.php to use the mysql driver; MariaDB speaks the same language.

Moving from cPanel

On cPanel you made a database and a user in two screens and typed them into wp-config.php or .env. Here the database and its main user come together, and the app gets them as variables. To bring your old data, export it from phpMyAdmin as a .sql file and import it. For a report or an accountant, add a read-only user.

The database's own page

Instead of phpMyAdmin, each database's page has its tables, rows and a query box, read only until you switch to Editing. A query shows at most 500 rows and stops after 30 seconds. A change without a WHERE, or one that drops, empties or alters a table, asks you first. Every change is kept in the activity log.

Memory

For an own MySQL or MariaDB, more memory takes effect at once: its cache and its connections grow with it, without a restart. Less memory restarts it in a few seconds. A shared MySQL has no limits to change: if it's not enough, move to your own.