How to install ESX framework on a FiveM server from scratch
Technical guide to install the ESX base on a FiveM server: dependencies, MySQL database, ensure order in server.cfg and verification.
ESX is the dominant roleplay framework on FiveM. Even though alternatives exist (QBCore, Ox Core, vRP), most commercial and free scripts on the market assume ESX is installed — so knowing how to assemble a clean base, without the technical debt accumulated from old tutorials, is the starting point for any server that intends to grow.
This guide covers installing es_extended 1.10+ with oxmysql as the database driver, ox_lib as the base library and ox_inventory as the inventory. This is the modern stack actively maintained in 2026 — different from 2020-2022 tutorials that still recommend mysql-async and esx_inventoryhud.
Estimated execution time: 30 to 45 minutes for someone who already has a FiveM server running. If you still need to install txAdmin and bring up the FXServer artifact, allow an extra hour.
Prerequisites
FiveM server already running (txAdmin recommended), MySQL 8.0+ or MariaDB 10.6+ installed and reachable, SSH access to the server (or management panel), a free FiveM license (cfx.re/keymaster) and about 200 MB of free space for the resources.
Before downloading anything, confirm that the base server boots cleanly — without ESX yet, just the bare FXServer. Connect via the FiveM client to the server IP and verify that it enters the default map without connection errors. If there is already a problem at this point, fix it first: ESX will amplify any instability in the underlying layer.
Have the database connection details ready:
127.0.0.1 3306 utf8mb4 esx_server Prepare the database
ESX uses MySQL to persist players, inventory, vehicles, jobs and everything that needs to survive a restart. The first action is creating the database with the correct charset — utf8mb4 is non-negotiable, modern scripts expect full 4-byte support (emojis, Asian characters, special symbols used in RP).
Connect to MySQL as a user with privileges to create a database:
mysql -u root -pCreate the database and a dedicated user for the server (do not use root in production):
CREATE DATABASE esx_server CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'esx_user'@'localhost' IDENTIFIED BY 'StrongPasswordHere123!';
GRANT ALL PRIVILEGES ON esx_server.* TO 'esx_user'@'localhost';
FLUSH PRIVILEGES;
EXIT;Write down the password — it will go into server.cfg next.
Download oxmysql from the official Overextended repository. Enter the FiveM server resources directory (usually server-data/resources/):
cd server-data/resources/
git clone https://github.com/overextended/oxmysql.git [standalone]/oxmysqlThe [standalone] wrap is a FiveM convention to group resources without dependencies among themselves. Create the folder first if it does not exist.
Add the connection string to your server.cfg, before any ensure of a resource that uses the database:
set mysql_connection_string "mysql://esx_user:StrongPasswordHere123!@localhost/esx_server?charset=utf8mb4"
ensure oxmysqlRestart the server and check the console for [oxmysql] Database server connection established!. If you see an authentication error, double-check user/password; for a host error, confirm that MySQL is listening on 127.0.0.1.
Install ox_lib and es_extended
With the database responding, the framework base comes next. ox_lib is a utility library (UI, callbacks, locale, cache) that modern ESX and most current scripts require as a declared dependency in the manifest.
Download ox_lib (latest official release build):
cd server-data/resources/[standalone]/
git clone https://github.com/overextended/ox_lib.gitUnlike simple scripts, ox_lib has a compiled UI build — always download from the tagged release, not from the main branch, to avoid a broken build.
Create the [esx] folder to group all framework resources. This makes ordering easier in server.cfg via ensure [esx] on some setups:
mkdir -p server-data/resources/\[esx\]
cd server-data/resources/\[esx\]
git clone https://github.com/esx-framework/esx_core.gitesx_core is the official monorepo — it contains es_extended, esx_menu_default, esx_menu_dialog, esx_menu_list and other auxiliary resources in a single structure.
Import the es_extended SQL schema into the database. Inside esx_core/es_extended/, there is the file es_extended.sql (or sometimes it lives in esx_core/setup.sql depending on the version):
mysql -u esx_user -p esx_server < server-data/resources/\[esx\]/esx_core/\[core\]/es_extended/install.sqlThis script creates the tables users, user_accounts, user_inventory, jobs, job_grades, addon_account, items and basic seeders. Without it, the server boots but any database call breaks.
The internal structure of esx_core has changed between versions. On some releases the SQL lives in [core]/es_extended/install.sql, on others directly in es_extended/install.sql. Search with find . -name "*.sql" inside esx_core before running.
Configure server.cfg
The ensure order defines what boots first. ESX is sensitive to this — resources that call ESX.GetPlayerFromId() before the framework finishes initializing return nil silently and the player becomes a ghost. The rule is simple: low-level drivers first, library next, framework after, consumer resources last.
Edit server.cfg and add the ESX block in the correct order, after the oxmysql that is already configured:
# Database (already configured earlier)
set mysql_connection_string "mysql://esx_user:StrongPasswordHere123!@localhost/esx_server?charset=utf8mb4"
ensure oxmysql
# Base library
ensure ox_lib
# ESX framework (order matters)
ensure es_extended
ensure esx_menu_default
ensure esx_menu_dialog
ensure esx_menu_list
ensure esx_notify
ensure esx_textui
ensure esx_progressbars
# Inventory (after framework)
ensure ox_inventorySave the file and restart the server fully (restart in the FXServer console is not enough — stop and bring it back up).
Install ox_inventory, which replaces the default ESX inventory:
cd server-data/resources/[standalone]/
git clone https://github.com/overextended/ox_inventory.gitox_inventory ships native integration with es_extended via an automatic bridge — you do not need to configure Config.Framework in recent versions, it detects the running ESX and connects on its own. Just make sure that ensure ox_inventory comes after ensure es_extended in the cfg.
If you run more than one framework on the same server (rare, but it happens in hybrid setups), force the bridge by editing ox_inventory/data/init.lua and setting framework = 'esx' explicitly. On a pure ESX server, leave it on automatic.
Verify the installation
Booting without errors in the console is half the job — the other half is confirming the framework actually works at runtime with a connected player.
Start the server and watch the console. You should see, in roughly this order:
[oxmysql] Database server connection established!
Started resource ox_lib
Started resource es_extended
[es_extended] ESX has started successfully!
Started resource ox_inventoryIf any of these is missing, the previous resource got stuck. Look for red or yellow lines in the console — they usually carry the reason (sql syntax error on install, dependency missing in the manifest, etc).
Connect to the server with your FiveM client. Open the F8 console in-game and type:
/setjob mechanic bossThis command ships with es_extended by default and assigns the mechanic job (boss grade) to the player. If ESX is alive, you get a visual notification of the job change. If nothing happens and the F8 console shows a command-not-found error, es_extended did not load — go back and review the ensure order.
Troubleshooting common issues
Error attempt to index a nil value (global 'ESX')
This means a script tried to use ESX = exports['es_extended']:getSharedObject() before the framework finished loading. It happens in poorly written client scripts. Solution: wrap the client initialization in a wait loop:
ESX = nil
CreateThread(function()
while ESX == nil do
ESX = exports['es_extended']:getSharedObject()
Wait(0)
end
end)
This pattern is the one officially recommended by the ESX team since version 1.10.
Player connects but the inventory is empty
Check whether the users table has a record for the player’s Steam/license identifier. If it does not, ox_inventory cannot load slots. Solution: make sure ensure es_extended comes before ensure ox_inventory and that the database is responding (no connection errors in the console).
Console shows oxmysql was unable to establish a connection
The connection string is wrong. Common causes: password with a special character without escaping (use a simple alphanumeric password or escape with %XX), MySQL listening only on a Unix socket and not on TCP 127.0.0.1 (edit bind-address in my.cnf), firewall blocking 3306 locally (rare but happens on servers with aggressive UFW configuration).
If you are testing on a VPS, never open port 3306 on the external firewall. ESX and oxmysql connect on 127.0.0.1 (localhost) — the database does not need to be reachable from outside. A MySQL database exposed to the internet is a guaranteed intrusion vector.
Next steps
With the ESX base running, the server is ready to receive the gameplay layer. Suggestions to keep going:
- Jobs and gangs: add
esx_jobs,esx_society,esx_billingto complete the base economy. Edit thejobsseeder in the database to create custom jobs for your RP. - MDT and police system: integrate
mdt-fivemor similar — it depends onoxmysqlandes_extendedalready running, so the base you just assembled is a prerequisite. - Loadouts and weapons: configure
Config.EnablePVPines_extended/config.luaand useox_inventoryto control weapon permissions per job. - Vehicle persistence: install
esx_vehicleshopfor the dealership and enable garage spawn withesx_garageorqb-garages-esx-bridge. - Performance: use the FXServer profiler (
profiler record 1000, thenprofiler view) to measure the tick of each resource. Above 1ms per resource on a loop, refactor or replace.
If you are taking the server to production with more than 32 slots, a machine dedicated to FiveM is worth the investment — tick rate drops noticeably when the server competes with web, database and other workloads on the same host. Hostini’s game hosting plans already ship with isolated CPU and local NVMe, which is exactly the profile ESX likes under real load.
Frequently asked questions
Which ESX version should I install in 2026?
Use es_extended 1.10.x or higher — it is the actively maintained line by the ESX Framework Org on GitHub. Versions 1.2 and earlier (original ESX Legacy) are obsolete and depend on mysql-async, which was discontinued in favor of oxmysql. Do not download random forks from unknown creators for the base.
Do I need oxmysql or can I keep using mysql-async?
Use oxmysql. mysql-async has not received an update in over two years and has a known connection leak under load. oxmysql uses the official MySQL driver with prepared statements, is maintained by Overextended and is what modern es_extended expects in its manifest. Migrating later costs more than starting right.
Why does the server boot but ESX:GetPlayerFromId returns nil?
Almost always it is the ensure order in server.cfg. oxmysql must boot before es_extended, and es_extended must boot before any resource that calls ESX. If a script tries to access the player before the framework finishes loading, it returns nil. Check the ensure ordering and add a while ESX == nil do Wait(0) end guard on the client.
ox_inventory or esx_inventoryhud — which one to use?
ox_inventory. It is lighter, actively supported, integrates natively with modern es_extended and covers slots, hotbar, drops and crafting. The old esx_inventoryhud depends on legacy resources and has slot count inconsistencies between client and server. Start with ox_inventory even if the initial learning curve is steeper.
Can I use MariaDB instead of MySQL?
Yes. MariaDB 10.6+ is compatible with the oxmysql driver and in many cases performs better under the concurrent load typical of RP servers. The es_extended schema (es_extended.sql) imports without adjustment. The only thing to watch is keeping utf8mb4 charset and utf8mb4_unicode_ci collation on the database — some creator scripts store emojis in chat fields and break on smaller charsets.
How many players can a server with the ESX base handle?
The ESX base itself consumes very little — around 0.05ms of tick on the server thread with 64 players. The real bottleneck comes from additional resources (jobs, MDT, inventory, poorly optimized creator scripts). A server with 8 dedicated vCPUs and NVMe SSD sustains 64-128 players comfortably if the rest of the stack is well written.