How to Install ESX on Your FiveM Server (ESX Legacy Guide)
ESX is the most widely used FiveM framework with the largest script library available. Here's how to install ESX Legacy correctly on a fresh server including database setup.
ESX (es_extended) is the original FiveM framework and despite being over seven years old, it still has the largest library of compatible scripts of any FiveM framework. If your server needs access to the widest possible range of existing resources, ESX is a strong choice. This guide covers installing ESX Legacy — the actively maintained modern version of ESX.
What You Need Before Starting
- A working FiveM server with server artifacts installed
- MySQL installed with a database already created
oxmysqlinstalled (ESX Legacy droppedmysql-asyncin favour of the fasteroxmysql)- Git installed on your server
Step 1: Download ESX Legacy
ESX Legacy is maintained on GitHub under the esx-framework organization. The esx_core repository bundles multiple required resources together:
git clone https://github.com/esx-framework/esx_core resources/[esx]/
This clones the following resources you will need:
es_extended— the core frameworkesx_menu_defaultesx_menu_dialogesx_menu_list
Check the repository README for the current full list of included resources as it can change between releases.
Step 2: Import the ESX SQL File
ESX requires a number of database tables including users, user_accounts, user_inventory, user_jobs, and more. The SQL file is included inside the es_extended resource folder.
Command line import:
mysql -u root -p your_database_name < resources/[esx]/es_extended/es_extended.sql
Using HeidiSQL:
- Connect to your MySQL server
- Select your FiveM database in the left panel
- Go to File → Run SQL File
- Select
es_extended.sqland run it - Verify no errors appear in the output
Step 3: Configure the Database Connection
Place this in your server.cfg before any ESX resources:
set oxmysql_connection_string "mysql://root:password@localhost/fivem_db?charset=utf8mb4"
oxmysql must also start before es_extended in your resource load order.
Step 4: Configure es_extended
Open es_extended/config.lua. Key settings to review and adjust:
Config.StartingAccountMoney = { bank = 5000, black_money = 0, money = 500 }
Config.EnableDebug = false -- set false in production
Config.Multichar = true -- enable multiple characters per account
Config.PlayerMaxWeight = 24 -- inventory weight limit (in kg)
Config.DefaultSpawn = vector3(215.17, -810.21, 30.73)
Read through the entire config before your first launch. Most ESX runtime issues originate from misconfigured values here.
Step 5: Add Resources to server.cfg
The correct load order for a basic ESX setup:
ensure oxmysql
ensure es_extended
ensure esx_menu_default
ensure esx_menu_dialog
ensure esx_menu_list
All ESX-dependent scripts must be listed below these lines. Adding a script before es_extended is the single most common cause of ESX installation failures.
Step 6: Install a Character System
ESX does not ship with character creation by default. Install these additional resources:
esx_skin— handles player appearance and character looksesx_identity— collects character name, date of birth, and sexesx_multichar(optional) — enables multiple characters per Steam account
Install each one, import its SQL file if it has one, and add it to server.cfg below es_extended.
Step 7: Add Jobs to the Database
Unlike QBCore which stores jobs in a Lua config file, ESX stores job definitions directly in the MySQL database. After the initial SQL import you will have a jobs table and a job_grades table.
You can insert jobs manually via HeidiSQL or the MySQL command line:
INSERT INTO jobs (name, label) VALUES ('police', 'Law Enforcement');
INSERT INTO job_grades (job_name, grade, name, label, salary, skin_male, skin_female)
VALUES ('police', 0, 'cadet', 'Cadet', 50, '{}', '{}');
INSERT INTO job_grades (job_name, grade, name, label, salary, skin_male, skin_female)
VALUES ('police', 1, 'officer', 'Officer', 75, '{}', '{}');
INSERT INTO job_grades (job_name, grade, name, label, salary, skin_male, skin_female)
VALUES ('police', 2, 'sergeant', 'Sergeant', 100, '{}', '{}');
Most ESX job scripts include their own .sql file that inserts the required job and grade rows automatically — check the script documentation before adding entries manually.
Step 8: Install Essential ESX Scripts
With ESX running without console errors, install these foundational scripts next (one at a time, testing after each):
esx_basicneeds— hunger and thirst systemesx_status— status bars displayed on screenesx_hud— player HUDesx_vehicleshop— vehicle purchasingesx_garage— persistent vehicle storage
Common ESX Installation Errors
Column 'identifier' cannot be null — The player identifier is not being passed correctly. Check Config.Identifier in es_extended/config.lua and ensure it matches the identifier your server provides (steam, license, discord, etc.).
attempt to index a nil value (global 'ESX') — A script that depends on ESX is loading before ESX itself. Fix the load order in server.cfg.
Table 'users' doesn't exist — The SQL file was not imported, or it was imported into the wrong database. Verify the table exists in HeidiSQL.
Couldn't start resource es_extended — A syntax error in config.lua or a missing dependency. Check the server console for the specific error line.
Browse thousands of ESX-compatible scripts for your server at modforge.xyz.