FiveM Database Setup: MySQL and oxmysql

Every RP framework on FiveM, whether ESX, QBCore or Qbox, stores player data in a MySQL or MariaDB database. Without a database the framework does not work: no inventory, no vehicles, no money, no jobs. oxmysql is the standard connector that links the framework to the database.

Step 1: create the database

All FiveM plans at HostValues include a database. In the game panel, under Databases, you find the option to create a new database. After creation you see:

  • Host: the address of the database server (usually localhost or an internal IP).
  • Port: default 3306.
  • Database name: the name you chose.
  • Username: auto-generated.
  • Password: click the eye icon to reveal it.

Step 2: install oxmysql

Download oxmysql from GitHub. Extract it and upload the folder to resources/[ox]/oxmysql/. Add to server.cfg:

ensure oxmysql

Place this above all resources that use the database.

Step 3: set the connection string

Add the connection string to server.cfg:

set mysql_connection_string "mysql://user:password@host:3306/databasename?charset=utf8mb4"

Replace the values with those from step 1. Watch out for special characters in the password: if it contains @ or #, URL-encode them (for example %40 for @).

Step 4: import framework SQL

Each framework has SQL files that create the database tables. Open phpMyAdmin via the game panel (button next to the database), click "Import" and upload the SQL file from your framework:

  • ESX: es_extended.sql
  • QBCore: qb-core.sql
  • Qbox: the SQL from the recipe or the qbx_core folder.

Most scripts you add later also have their own SQL. Import them the same way.

Step 5: test

Start the server. In the console you should see:

[oxmysql] Database server connection established

If you see "connection refused" or "access denied", check the connection string for typos, verify the database exists and confirm the password is correct.

Common problems

  • ER_NOT_SUPPORTED_AUTH_MODE: your MySQL server requires a different authentication method. This rarely happens with MariaDB; with MySQL 8+ you may need to set mysql_native_password.
  • Tables already exist: you imported the SQL twice. Not harmful; the import does not overwrite existing tables.
  • Charset errors: do not forget ?charset=utf8mb4 in the connection string. Without it, emojis and special characters are not stored correctly.

A database is included with all FiveM plans. For questions about database setup, our support team is ready to help.

Can I use SQLite instead of MySQL?

Technically yes, but no RP framework supports it by default. MySQL or MariaDB is the expectation. With a database included in every FiveM plan, there is no reason to use SQLite.

How do I back up my database?

Via phpMyAdmin: select the database, click "Export", choose "Quick" and "SQL", and download the file. Store it separately. For a fresh install, import this file again.

Can I browse the database while the server is running?

Yes. phpMyAdmin shows live data. You can view player data, vehicles and inventories directly and adjust them if needed. Be careful: a mistake in the database can corrupt player data.


Still stuck? Open a support ticket and our team will help you out.

Back to the blog