Skip to content

Database and frameworks

Updated July 02, 2026
FiveM
FiveM Database and Frameworks | GameServerKings KB

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, Configuration, and Running as a 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
set mysql_connection_string "server=127.0.0.1;database=fivem;userid=root;password=YOUR_DB_PASSWORD"

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. 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
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:

ResourcePurposeSource
oxmysqlDatabase connector (dependency for most)github.com/overextended/oxmysql
EasyAdminIn-game admin toolgithub.com/Brrocky/EasyAdmin
vMenuAll-in-one menu (admin + player)github.com/TomGrobbe/vMenu
pma-voiceBuilt-in proximity voice chatgithub.com/AvarianKnight/pma-voice
screenshot-basicScreenshot capability for admin toolsFiveM forums
chat-themeCleaner chat UIFiveM 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:

Code
[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.
Made with 💜 by GameServerKings