The database is the brain of your server. While MariaDB is standard, PostgreSQL is gaining popularity.
oxmysql is the standard SQL driver for FiveM. It supports both MySQL/MariaDB.
server.cfg)# Basic connection
set mysql_connection_string "mysql://user:password@localhost/fivem_db?charset=utf8mb4"
# Slow query warning (warns if query takes > 200ms)
set mysql_slow_query_warning 200
# Debug mode (prints all queries - dev only)
set mysql_debug 0Standard for ESX/QBCore.
Run a clean database instance with Docker:
version: '3.8'
services:
mariadb:
image: mariadb:10.11
restart: always
environment:
MYSQL_ROOT_PASSWORD: root_secure_password
MYSQL_DATABASE: fivem_prod
MYSQL_USER: fivem
MYSQL_PASSWORD: user_secure_password
ports:
- '3306:3306'
volumes:
- ./mysql_data:/var/lib/mysqlQbox and some modern resources support PostgreSQL.
set mysql_connection_string "postgres://user:password@localhost/fivem_db"Note: Ensure your resources explicitly support PostgreSQL before switching. Many legacy scripts use MySQL-specific syntax (like backticks `table` instead of quotes “table”).
WHERE clauses (like identifier, license, vehicle_plate) are indexed.
CREATE INDEX idx_users_identifier ON users(identifier);max_connections is high enough (default 151 is usually fine).