QBCore, Qbox, ESX, and most modern economies expect a MySQL-compatible database. On Linux, MariaDB is the usual choice. This guide covers a clean local setup for oxmysql.
Install MariaDB (Linux VPS sketch)
sudo apt update
sudo apt install -y mariadb-server
sudo mysql_secure_installation
Create database and user
CREATE DATABASE qbcore CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'fivem'@'localhost' IDENTIFIED BY 'USE_A_LONG_RANDOM_PASSWORD';
GRANT ALL PRIVILEGES ON qbcore.* TO 'fivem'@'localhost';
FLUSH PRIVILEGES;
oxmysql connection string
In server.cfg (syntax per current oxmysql docs):
set mysql_connection_string "mysql://fivem:PASSWORD@127.0.0.1/qbcore?charset=utf8mb4"
ensure oxmysql
Import framework SQL before expecting characters to save. Use the SQL files shipped with your framework version.
Security
- Bind MariaDB to
127.0.0.1unless you have a private DB network. - Do not allow
3306/tcpfrom0.0.0.0/0. - Store passwords outside public Git repos; treat
server.cfgas secret.
Managed hosting note
On Chapter22 game hosting, databases are often provisioned alongside the server—use the panel credentials rather than installing MariaDB yourself.
Related guides
- oxmysql Installation Guide
- How to Create a FiveM Database and User
- FiveM Ports Explained: 30120 TCP/UDP and txAdmin
- How to Open Ports on a Linux VPS (UFW, firewalld, iptables)
Frequently Asked Questions
Should FiveM connect as root?
No. Create a dedicated database user with rights only on the framework database.
Do I open 3306 in UFW for oxmysql?
Not when MariaDB runs on the same machine—use 127.0.0.1. Open 3306 only for tightly restricted remote administration.
Need help?
If you are stuck after following this guide, open a ticket from the Chapter22 client area with the exact error, the port or DNS change you made, and whether the service listens locally (ss / Resource Monitor) but fails externally.
Build the server. Grow the community. Start your next chapter.
