
FiveM Database (MySQL/MariaDB) Setup 2026
Every framework server stores players, vehicles, inventories and more in a SQL database. This sets up a clean, fast database with oxmysql.
Choose an engine
- MySQL 8 or MariaDB 10.6+ are both fine.
- On Windows, XAMPP/HeidiSQL is common for testing; on production, install the engine directly.
Step 1: Create database and user
CREATE DATABASE qbcore CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
CREATE USER 'fivem'@'localhost' IDENTIFIED BY 'a-strong-password';
GRANT ALL PRIVILEGES ON qbcore.* TO 'fivem'@'localhost';
FLUSH PRIVILEGES;Use utf8mb4 so emojis and special characters don't corrupt data.
Step 2: Install oxmysql
Place oxmysql in resources and ensure it before your framework:
set mysql_connection_string "mysql://fivem:a-strong-password@localhost/qbcore?charset=utf8mb4"
ensure oxmysql
ensure qb-coreStep 3: Import framework SQL
Import the SQL that ships with QBCore/ESX and each resource (inventory, banking, etc.). Use HeidiSQL, DBeaver or the command line.
Step 4: Verify
- Console shows oxmysql connecting with the correct database.
- No "table doesn't exist" errors on boot — that means missing SQL.
Performance and safety basics
- Keep the database on the same machine (or a very low-latency link) as the server.
- Add indexes for columns you query often (e.g.
citizenid). - Back up daily — automate a dump and store it off-box.
mysqldump -u fivem -p qbcore > backup_$(date +%F).sqlCommon mistakes
- Wrong connection string (user, password or database name).
- oxmysql loaded after the framework.
- Skipping a resource's SQL import, causing runtime errors.
What You Will Learn
This Server Setup tutorial focuses on practical outcomes for FiveM scripting and QB Core development. By following the steps in FiveM Database (MySQL/MariaDB) Setup 2026, you will understand how the topic fits into a real server workflow and how to apply it safely.
You will learn the reasoning behind the implementation choices (especially for beginner topics), so you can make the same decisions again for future resources. The goal is to reduce trial-and-error, improve consistency across updates, and help your team ship changes without breaking gameplay.
- Identify the correct use case for this approach in a QB Core or FiveM environment
- Implement the key concepts with an install-ready workflow
- Validate compatibility and avoid common setup conflicts
- Apply best practices to keep your server stable over time
Why This Matters
When scripts, configs, and documentation are aligned with your server architecture, you reduce maintenance overhead. That means fewer upgrade surprises, faster onboarding for new admins, and a more reliable experience for your players.
FAQ
Do I need advanced knowledge? This tutorial is matched to a Beginner difficulty level, and the steps are designed to build confidence without assuming everything is already known.
Will this work on my QB Core server? The tutorial emphasizes compatibility and integration checks so you can confirm requirements before installing.
How do I apply this to my next update? Use the same workflow and validation approach described here, then adapt the final details to your server’s setup.