MariaDB is a fork of MySQL that speaks the same protocol: MySQL drivers and tools connect to it as is. On Webgune, MariaDB 11 exists only as a project database, a service in your project with its volume. There is no managed MariaDB.
| Value | |
|---|---|
| Version | MariaDB 11 |
| Port | 3306 |
| User | kxuser, unless you chose otherwise at creation |
| Storage | 5 GB volume |
| Resources | at most 1 vCPU and 1 GB of memory, taken from your plan |
| Instances | one only, no sleep mode |
Create a MariaDB database
- In the project, New service, then Deploy MariaDB.
- Fill in the Database name. The User is
kxuserif the field is left empty, the Password is generated if the field is left empty (at least 8 characters otherwise). - Click Create.
The service panel opens on the Database tab: internal host, port, user, masked password, database name and full connection string, each with a copy button. The root account has the same password as the user.
Connection string
# From a service in the same project
DATABASE_URL=mysql://kxuser:MOT_DE_PASSE@ma-db.kx-boutique-1a2b3c4d.svc.cluster.local:3306/ma-db
# From outside, public access turned on
DATABASE_URL=mysql://kxuser:MOT_DE_PASSE@HOTE_PUBLIC:PORT_PUBLIC/ma-db
The scheme stays mysql://. The internal address answers only the services of the same project (Network and isolation).
Prisma
datasource db {
provider = "mysql" // valid for MariaDB
url = env("DATABASE_URL")
}
Node.js (mysql2)
import mysql from "mysql2/promise";
const pool = mysql.createPool({ uri: process.env.DATABASE_URL!, connectionLimit: 10 });
const [rows] = await pool.query("SELECT * FROM users WHERE id = ?", [42]);
The mariadb package works too. Both accept the same string.
Access from your machine
Turn on Public access in the Database tab. The panel shows a Public host and a Public port, different from 3306.
mariadb -h HOTE_PUBLIC -P PORT_PUBLIC -u kxuser -p ma-db
This port is open to the whole Internet, with no address list: only the password protects the database. Turn the access off after the intervention. Each opening and each closing is recorded in the project's Activity tab.
Queries from the panel
The console in the Database tab runs the query with the engine's client and stops it after 30 seconds. It suggests SHOW TABLES; by default. Write queries really apply.
MySQL or MariaDB
| Criterion | MySQL | MariaDB |
|---|---|---|
| Managed database available | yes | no |
| Project database | MySQL 8.4 | MariaDB 11 |
| Move to a managed database from the panel | yes | no |
| WordPress, Laravel, PHP | compatible | compatible |
JSON type | native type | alias of LONGTEXT with a validity check |
An application that documents MySQL works with either. If you want a database replicated across three servers, restorable after deletion, choose a managed MySQL database.
Move from MariaDB to a managed MySQL database
The Move to a managed database button does not exist for MariaDB. The move is done with a dump:
# 1. Export from MariaDB (public access turned on)
mariadb-dump --single-transaction -h HOTE_PUBLIC -P PORT_PUBLIC -u kxuser -p ma-db > export.sql
# 2. Import into the managed database (your address allowed in Network access)
mysql --ssl-mode=REQUIRED -h HOTE -P 3306 -u USER -p BASE < export.sql
The Data tab of the managed database also accepts an SQL file of up to 64 MB. Then replace DATABASE_URL in your services, check, then delete the old service.
Backups
The service's Backups tab schedules dumps and volume snapshots (Backups and restore). Deleting the service deletes its data: make a dump first.
Common errors
| Symptom | Cause | What to do |
|---|---|---|
| "Pod not available. Database starting" | MariaDB has not finished starting | wait a few seconds, then read the Logs tab |
Access denied for user | password different from the one in the Database tab | copy the connection string again |
Unknown MySQL server host from your machine | internal address used | turn on Public access |
| Stop with code 137 | the database exceeds 1 GB of memory | reduce innodb_buffer_pool_size or move to a managed database |
Updated on