Database: MariaDB and oxmysql
In short
Frameworks keep players, money, items and vehicles in MariaDB (or MySQL) through oxmysql. The database is the most valuable thing on the machine — set it up properly and back it up from the first day.
sudo apt install -y mariadb-server
sudo mariadb-secure-installation
sudo mariadbCREATE DATABASE fivem CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'fivem'@'127.0.0.1' IDENTIFIED BY 'a-long-random-password';
GRANT ALL PRIVILEGES ON fivem.* TO 'fivem'@'127.0.0.1';
FLUSH PRIVILEGES;set mysql_connection_string "mysql://fivem:[email protected]/fivem?charset=utf8mb4"
set mysql_slow_query_warning 200
ensure oxmysql- Use a dedicated user with rights on one database only — never
root. - Keep 3306 closed to the internet; manage the database over an SSH tunnel.
- Import the framework’s SQL file before the first start.
- oxmysql prints a warning for queries slower than
mysql_slow_query_warning(200 ms by default). Treat each one as a bug: add an index or move the query out of a loop. - Index columns you search by — identifiers, citizen IDs, plates.
Schema tips for developers: FiveM database design.