How to Set Up a MySQL Database for Your FiveM Server
Create a MySQL database on your FiveM server, configure oxmysql, and import .sql files for ESX or QBCore frameworks.
Both ESX and QBCore store player data, vehicles, jobs, and economy in a MySQL database. The standard connector is oxmysql (replaces the older mysql-async and ghmattimysql).
Create a Database
Open the Databases tab
In the XGamingServer Panel, click Databases in the sidebar.
Create a new database
Click New Database. Note the generated credentials:
- Host (e.g.,
127.0.0.1) - Port (e.g.,
3306) - Database name
- Username
- Password
You'll need these for the connection string.
Configure oxmysql
Add the connection string to your server.cfg (via Files in the sidebar):
set mysql_connection_string "mysql://dbuser:dbpassword@127.0.0.1:3306/dbname?charset=utf8mb4"Alternative format (for passwords with special characters)
If your password contains ;, /, ?, @, &, =, +, $, or #, use the semicolon format:
set mysql_connection_string "user=dbuser;password=dbpassword;host=127.0.0.1;port=3306;database=dbname"Then ensure oxmysql starts before any framework resources:
ensure oxmysql
ensure es_extended # or ensure qb-coreImport .sql Files
Framework installation requires importing an SQL file that creates the database tables. If the txAdmin recipe handled this automatically, you can skip this step.
Open phpMyAdmin
From the Databases tab on the panel, click the phpMyAdmin link (or access it directly).
Select your database
Click your database name in the left sidebar.
Import the SQL file
Click the Import tab. Click Choose File and select the .sql file:
- ESX:
legacy.sql(from the esx_core download) - QBCore:
qbcore.sql(from the txAdmin recipe)
Click Go to import.
Verify the Connection
After starting the server, check Console for:
[oxmysql] Connected to databaseIf you see connection errors, check:
| Error | Fix |
|---|---|
Access denied for user | Wrong username or password in the connection string |
Unknown database | Database name doesn't match — check Databases tab |
AUTH_SWITCH_PLUGIN_ERROR | MySQL 8+ auth issue. Set the user to mysql_native_password authentication |
Connection refused | Wrong host/port, or database server not running |
| Connection string with special chars fails | Switch to semicolon format |
Related Guides
How is this guide?

How to Add a Custom Loading Screen to Your FiveM Server
Create and install a custom HTML loading screen on your FiveM server with progress tracking and cursor support.
ESX vs QBCore: Which FiveM Framework Should You Choose?
Compare ESX Legacy and QBCore frameworks for your FiveM RP server — features, architecture, and which is right for your community.