---
title: "Configuring your FiveM database and frameworks"
description: "Install MariaDB, configure the oxmysql driver, load ESX or QBCore frameworks in server.cfg, and fix common load-order connection pitfalls."
url: "https://www.gameserverkings.com/knowledge-base/fivem/database-and-frameworks/"
category: "FiveM"
category_url: "https://www.gameserverkings.com/knowledge-base/fivem/"
published: "2026-07-02T01:25:54.151Z"
updated: "2026-07-31T23:04:36.387Z"
source_format: "markdown"
site: "GameServerKings"
---

# Configuring your FiveM database and frameworks

Most serious FiveM servers run a framework (ESX or QBCore) on top of a MySQL/MariaDB database. This guide covers installing the database, the two dominant frameworks, and the common resources nearly every server adds. Complete [Setup](/knowledge-base/fivem/setup/), [Configuring your FiveM server](/knowledge-base/fivem/configuration-overview/), and [Running as a Service](/knowledge-base/fivem/running-as-service/) first.

## Database Setup (MariaDB)

Most FiveM frameworks need MySQL or MariaDB. Install MariaDB on the same Windows machine:

1. Download MariaDB Server from `mariadb.org`.

2. Run the installer. Set a strong root password. Keep the default port (3306).

3. Open HeidiSQL (bundled with MariaDB) and connect with root credentials.

4. Create a database for your server: right-click in the panel, **Create new** > **Database**. Name it `fivem`.

5. If using ESX or QBCore, import their SQL schema file (downloaded with the framework) into this database.

### Connecting Resources to the Database

Your server resources connect via the `oxmysql` resource (modern) or the older `mysql-async`. The connection string in `server.cfg` looks like:

```cfg title="server.cfg"
set mysql_connection_string "server=127.0.0.1;database=fivem;userid=root;password=YOUR_DB_PASSWORD"
```

> [!TIP] Use a dedicated database user, not root
> **Better practice**: create a dedicated MySQL user with access only to the `fivem` database rather than using root. In HeidiSQL, go to **Tools** > **User manager**, create a user, and grant it privileges on the `fivem` database only.

### Installing oxmysql

Most modern frameworks depend on `oxmysql`:

1. Download the latest release from `github.com/overextended/oxmysql`.

2. Extract into `C:\FXServer-data\resources\oxmysql\`.

3. Add `ensure oxmysql` near the top of your `server.cfg` resource list (before any framework that needs it).

4. Set the connection string as shown above.

## Installing a Framework

The two dominant FiveM frameworks are **ESX Legacy** and **QBCore**. Both are GitHub-based, free, and well-documented.

> [!IMPORTANT] Run one framework, never both
> Pick one; they are not meant to run together.

### ESX Legacy

1. Navigate to your resources folder and clone the framework:
   ```powershell
   cd C:\FXServer-data\resources
   git clone https://github.com/esx-framework/esx_legacy.git [esx_legacy]
   ```
   (The square brackets create a resource category folder, which FiveM uses for load ordering.)

2. Import the ESX SQL schema into your `fivem` database via HeidiSQL.

3. Read the README at the cloned repo for current install steps; they change between versions.

4. In `server.cfg`, ensure the resources load in the correct order (oxmysql first, then ESX core, then ESX-dependent resources).

### QBCore

1. Follow the install guide at `docs.qbcore.org`. It is well-maintained and version-accurate.

2. QBCore uses `oxmysql`; ensure that resource is installed and the connection string is set.

3. Import the QBCore SQL schema into your database.

These frameworks are deep ecosystems with their own job, vehicle, and inventory systems. Their official docs are the source of truth and change frequently, so always follow the live docs rather than a cached tutorial.

## Load Order Matters

FiveM starts resources in the order their `ensure` lines appear in `server.cfg`. A typical framework load order:

```cfg title="server.cfg"
ensure oxmysql
ensure es_extended      # or qb-core
ensure esx_menu_default
ensure esx_menu_list
ensure esx_menu_dialog
# ... then job, shop, and other dependent resources
```

If a resource fails to load with a dependency error, it is almost always loading before something it needs. Move its `ensure` line further down.

## Common Resources

Beyond a framework, most servers add:

| Resource | Purpose | Source |
|----------|---------|--------|
| oxmysql | Database connector (dependency for most) | `github.com/overextended/oxmysql` |
| EasyAdmin | In-game admin tool | `github.com/Brrocky/EasyAdmin` |
| vMenu | All-in-one menu (admin + player) | `github.com/TomGrobbe/vMenu` |
| pma-voice | Built-in proximity voice chat | `github.com/AvarianKnight/pma-voice` |
| screenshot-basic | Screenshot capability for admin tools | FiveM forums |
| chat-theme | Cleaner chat UI | FiveM forums |

Install by cloning or extracting into `C:\FXServer-data\resources\` and adding `ensure resource_name` in `server.cfg`.

## Verifying the Database Connection

After starting the server with oxmysql and a framework, watch the console. A healthy connection logs something like:

```
[oxmysql] Database server connection established.
```

If you see connection refused or access denied:

- Confirm MariaDB is running (`Get-Service MariaDB` in PowerShell)
- Confirm the connection string credentials are correct
- Confirm the database name in the string matches the one you created

## Common Issues

- **"oxmysql was unable to connect"**: Wrong credentials or MariaDB is not running. Verify both.
- **Framework loads but jobs/shops are missing**: SQL schema was not imported. Re-import the framework's `.sql` file into your database.
- **"attempted to load resource X before its dependency"**: Load order problem. Move the dependency's `ensure` line higher in `server.cfg`.
- **Database works but data does not persist**: Some resources cache and only write on disconnect or scheduled save. Confirm the resource's save interval settings.

## What to Read Next

- [OneSync, Updates, and Backups](/knowledge-base/fivem/onesync-updates-backups/) for database backup procedures and scaling
- [Running as a Service](/knowledge-base/fivem/running-as-service/) to keep everything running through reboots
- Official framework docs: `docs.esx-framework.org` and `docs.qbcore.org`

---

Made with 💜 by GameServerKings
