databasemariadboxmysql10 min read · updated 9/11/2026

Setting up MariaDB for a FiveM server

ESX, QBCore, Qbox and nearly every roleplay script store their data in a MySQL-compatible database, reached through oxmysql. Setting it up is a one-time job: install MariaDB, create a database and a user, and give oxmysql the connection string.

Short answer: Install MariaDB (apt install mariadb-server on Debian/Ubuntu, the MSI installer on Windows), run mariadb-secure-installation, then create a utf8mb4 database and a dedicated user with rights only on it. Add set mysql_connection_string "mysql://user:password@localhost/dbname?charset=utf8mb4" to server.cfg and make sure oxmysql starts before your framework. Keep port 3306 closed to the internet.

FiveM MariaDB Setup: Install, Create a User and Connect oxmysql

#Installing

Debian / Ubuntu
apt update && apt -y install mariadb-server
mariadb-secure-installation

On Windows, download the MariaDB MSI installer from mariadb.org, set a root password during setup and keep “Enable access from remote machines” off. XAMPP is fine for local testing but not for a live server.

#Creating the database and user

mariadb -u root -p
CREATE DATABASE fivem CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'fivem'@'localhost' IDENTIFIED BY 'a-long-random-password';
GRANT ALL PRIVILEGES ON fivem.* TO 'fivem'@'localhost';
FLUSH PRIVILEGES;

Framework recipes in txAdmin can create the database for you when you give them credentials. Either way, import the framework’s SQL files into this database.

#Connecting oxmysql

server.cfg
set mysql_connection_string "mysql://fivem:a-long-random-password@localhost/fivem?charset=utf8mb4"

ensure oxmysql
ensure ox_lib
ensure qbx_core   # or es_extended / qb-core

Special characters in the password must be URL-encoded in this form (for example @ becomes %40), or use the key-value format oxmysql also accepts. Script-side usage is in the oxmysql guide.

#Looking inside the database

  • HeidiSQL (Windows) — connect over SSH tunnel to a remote server instead of opening 3306.
  • DBeaver (cross-platform) — same idea.
  • phpMyAdmin — only behind a login you control, never public without protection.

#Basic tuning and safety

SettingSuggestion
bind-address127.0.0.1 so only the local machine can connect
innodb_buffer_pool_sizeA good share of spare RAM (for example 1–4 GB on a dedicated game box)
Slow query logEnable briefly to find slow script queries
BackupsDaily dumps — see server backups

Questions

Should I use MariaDB or MySQL for FiveM?
Either works with oxmysql. MariaDB is the common choice and easy to install.
What is the oxmysql connection string?
set mysql_connection_string "mysql://user:password@host/database?charset=utf8mb4" in server.cfg.
Why does oxmysql say access denied?
Wrong user, password or host in the connection string, or the user has no rights on that database.
Should I open port 3306?
No. Keep the database local and use an SSH tunnel for remote tools.

Ready to pick a map?

Twelve themes on three base map styles, $8 each, instant download.