Almost every serious FiveM server needs a database. Frameworks like ESX, QBCore and QBox store players, characters, money, vehicles and inventories in MySQL/MariaDB — so getting the database right is a core setup step. This guide covers how to set up a database for FiveM.
MySQL or MariaDB?
Either works, and the FiveM community largely uses MariaDB (a drop-in MySQL fork) for performance. The connection details are identical from FiveM’s point of view. Your host may provide one for you; if you self-host, install MariaDB and a management tool like HeidiSQL or phpMyAdmin to work with it visually.
Step 1: Create the database
- Open your database tool (HeidiSQL/phpMyAdmin) and connect to your MySQL/MariaDB server.
- Create a new database (schema) — e.g.
fivemor your server name. - Create a database user with a strong password and grant it full privileges on that database.
Step 2: Install oxmysql
oxmysql is the standard, async database connector in 2026 — almost every modern resource depends on it. Place it in resources and ensure it before your framework and any script that uses the database.
Step 3: Add your connection string
Tell oxmysql how to reach your database with a single line in your server.cfg:
set mysql_connection_string "mysql://user:password@localhost:3306/fivem?charset=utf8mb4"
Replace the user, password, host and database name with yours. If the database is on the same machine, localhost is correct; managed hosts usually supply the exact host and port.
Step 4: Import your framework’s SQL
Your framework and many scripts ship .sql files that create their tables. Import them into your database through HeidiSQL/phpMyAdmin (File → Run SQL file, or paste and execute). Do this for the framework first (ESX/QBCore/QBox), then each script that needs tables. Skipping a script’s SQL is the #1 cause of “table doesn’t exist” console errors.
Verifying it works
Start the server and watch the console: oxmysql prints a connection confirmation, and any database errors show the exact table or query at fault. If you see connection refused, double-check the connection string, that MariaDB is running, and that the user has privileges.
The managed shortcut
On managed FiveM hosting, the database is provisioned for you — oxmysql and the connection string are wired up, and you import SQL through the panel, skipping the MariaDB install entirely.
Frequently asked questions
Does a FiveM server need a database?
If you run a framework (ESX, QBCore, QBox) or any persistent script — yes. The database stores players, money, characters and inventories.
MySQL or MariaDB for FiveM?
Either; MariaDB is the common choice for performance and is a drop-in MySQL replacement.
What is oxmysql?
The standard async database connector for FiveM. You set your connection string for it in server.cfg and ensure it before your framework.
Why do I get “table doesn’t exist” errors?
You haven’t imported that resource’s SQL file into your database. Import the framework and each script’s SQL.
Ready to play?
Run your own FiveM server with XGamingServer
Spin up an always-on FiveM server your friends can join in minutes — no port-forwarding, no tech headaches.




