# MariaDB

Source : https://webgune.cloud/en-us/docs/db-mariadb · Mis à jour le 2026-10-27

# MariaDB

MariaDB is a community fork of MySQL, compatible with its protocol and drivers: if your tool speaks MySQL, it speaks MariaDB.

## Creating an instance

**+ New service → Database → MariaDB**. Credentials (host, port, user, password, database name) are generated automatically and visible in the service panel, **Connection** tab.

## Connection string

```bash
# From another service in the same project (internal network)
DATABASE_URL=mysql://user:password@internal-host:3306/mydatabase

# From outside (exposed public port)
DATABASE_URL=mysql://user:password@public-ip:PORT/mydatabase
```

> The connection string scheme remains `mysql://`: MySQL drivers work as-is with MariaDB.

## Prisma

```prisma
datasource db {
  provider = "mysql"        // valid for MariaDB
  url      = env("DATABASE_URL")
}
```

## mysql2 (Node.js)

```typescript
import mysql from "mysql2/promise";

const pool = mysql.createPool(process.env.DATABASE_URL!);
const [rows] = await pool.query("SELECT * FROM users WHERE id = ?", [42]);
```

## MySQL or MariaDB?

| Criterion | Verdict |
|---------|---------|
| Application compatibility | Identical in the vast majority of cases |
| WordPress, PHP tools | Both work. MariaDB is often recommended |
| Very specific recent features (MySQL 8 JSON…) | Check for parity before choosing |

If in doubt, stick with whatever your framework documents. Migrating from one to the other remains simple (dump/restore).

## Backups

As with other databases, remember to take regular dumps:

```bash
mysqldump -h HOST -P PORT -u USER -p MYDATABASE > backup.sql
```

See also: [MySQL](/docs/db-mysql), [Databases](/docs/bases-de-donnees)
