All articles
FrameworksESXESX Legacyes_extended

How to Install and Configure ESX Legacy on FiveM

Complete step-by-step guide to installing ESX Legacy on your FiveM server: prerequisites, SQL import, oxmysql connection string, server.cfg load order, and first-run checks.

February 12, 20269 min readBy CRM Development
On this page

ESX Legacy (es_extended) is the most widely used FiveM roleplay framework, powering thousands of servers ranging from hardcore whitelisted communities to public economy servers. Installing it correctly from the start is critical — a misconfigured database connection or wrong load order will prevent your entire server from functioning. This guide walks you through every step.

Before touching any files, make sure you understand the stack: ESX needs a FiveM server artifact, a MySQL or MariaDB database, the oxmysql resource, and then es_extended itself. Everything else — jobs, police, hospitals, shops — layers on top of that foundation.

Prerequisites

  • FiveM server artifact (latest recommended build from runtime.fivem.net/artifacts/fivem)
  • MySQL 8.x or MariaDB 10.6+ installed on your server or a remote host
  • A database management tool: HeidiSQL (Windows) or phpMyAdmin
  • A blank database created for your FiveM server (e.g., named 'fivem_esx')
  • txAdmin or a working server.cfg with a valid sv_licenseKey
  • oxmysql resource downloaded from github.com/overextended/oxmysql (releases page)

Step 1 — Download ESX Legacy

Go to the ESX Legacy GitHub repository (github.com/esx-framework/esx_core) and download the latest release. Extract the archive — you will find an es_extended folder inside. Place this folder in your server's resources directory, typically under a subfolder like [esx] to keep things organized.

Use ESX Legacy, Not Old ESX

There are outdated ESX versions still circulating. Always use the ESX Legacy fork from the official esx-framework GitHub organization. Old versions are unsupported, have known bugs, and are not compatible with modern oxmysql.

Step 2 — Import the SQL Database

Inside the es_extended folder you will find an SQL file (usually named es_extended.sql or similar). Open HeidiSQL or phpMyAdmin, select your blank database, and import this file. It creates the tables ESX needs: users, user_accounts, user_jobs, user_vehicles, and others. Without this import, ESX will throw database errors on startup.

Import oxmysql Has No SQL File

oxmysql itself does not need a database import — it is only a connector. Only es_extended and other scripts with their own .sql files need to be imported.

Step 3 — Configure the oxmysql Connection String

oxmysql reads your database credentials from a convar in server.cfg named mysql_connection_string. Set it before any resource is ensured. The recommended format uses a URI-style connection string:

cfg
# oxmysql connection string — set BEFORE any ensure lines
set mysql_connection_string "mysql://dbuser:[email protected]/fivem_esx?charset=utf8mb4"

# Replace dbuser, dbpassword, and fivem_esx with your actual credentials.
# If your database is on a remote host, replace 127.0.0.1 with that host's IP.

Alternatively, oxmysql also accepts the older key=value format: set mysql_connection_string "host=127.0.0.1;database=fivem_esx;userid=dbuser;password=dbpassword;". Both formats work, but the URI style is cleaner and more widely documented.

Step 4 — Set the server.cfg Load Order

Load order in server.cfg is non-negotiable. oxmysql must be ensured before es_extended. Any ESX-dependent resource (jobs, police, shops, phone) must come after es_extended. A wrong order produces cryptic nil-reference errors that are difficult to trace.

cfg
# ============================================================
# server.cfg — ESX Legacy recommended load order
# ============================================================

set onesync on

# Database connection (must appear before any ensure)
set mysql_connection_string "mysql://dbuser:[email protected]/fivem_esx?charset=utf8mb4"

# 1. Core connector
ensure oxmysql

# 2. ESX framework
ensure es_extended

# 3. ESX-dependent resources (examples)
ensure esx_identity
ensure esx_multicharacter
ensure esx_skin
ensure esx_vehicleshop
ensure esx_policejob
ensure esx_ambulancejob

# 4. Inventory (if using ox_inventory with ESX)
ensure ox_inventory

Step 5 — Configure ESX (config.lua)

Open es_extended/config.lua. The most commonly adjusted settings for a new server are:

  • Config.StartingMoney — the cash and bank balance new characters receive on first spawn
  • Config.EnableDebug — set to false in production to reduce console noise
  • Config.DefaultSpawn — the coordinates where new players first appear
  • Config.LogoURL — the image shown in ESX UI panels (set to your community logo)
  • Config.MaxWeight — maximum inventory weight if you are using ESX's built-in inventory

ox_inventory Replaces ESX Inventory

Most modern ESX servers use ox_inventory instead of the built-in ESX inventory. If you are using ox_inventory, you will configure item weights and slots there rather than in ESX's config.lua. CRM Development's server packs come pre-configured with ox_inventory.

Step 6 — Enable OneSync

Add `set onesync on` to server.cfg. OneSync is required for more than 32 player slots and is expected by virtually all modern ESX resources. Without it, player synchronization will break on populated servers and many scripts will behave incorrectly.

Step 7 — Start the Server and Verify

Start your FiveM server and watch the console carefully. A successful ESX startup looks like this: oxmysql connects to the database without errors, then es_extended reports it has started. If you see a database connection error, double-check your mysql_connection_string convar for typos in the hostname, username, password, or database name.

  • Console shows 'oxmysql connected' and no SQL errors
  • Console shows 'ESX started' (exact message varies by ESX Legacy version)
  • Connecting with a FiveM client triggers the character creation/selection screen
  • Character spawns in the world with correct job (defaulting to unemployed) and starting money
  • Server console logs player join without Lua errors

Common Installation Errors

Error / SymptomLikely CauseFix
Database connection failedWrong credentials in mysql_connection_stringVerify host, username, password, and database name
nil value error on ESX exportA resource ensured before es_extendedMove the resource's ensure line below es_extended in server.cfg
Character screen never appearsMissing esx_multicharacter or wrong ensure orderEnsure esx_multicharacter after es_extended and verify SQL was imported
Items not loading / inventory errorsox_inventory SQL not imported or wrong versionImport ox_inventory's SQL file and confirm version matches es_extended
OneSync errors or desynced playersset onesync missing or set to offAdd set onesync on to server.cfg

Conclusion

Installing ESX Legacy comes down to four things in the right order: database ready, SQL imported, connection string set, and resources ensured correctly. Follow this guide's server.cfg load order exactly and you will avoid the majority of setup issues that trip up new server owners. If you want to skip the manual assembly entirely, CRM Development's ESX server packs come with es_extended, oxmysql, and all dependent scripts pre-configured and tested — so you can focus on building your community rather than debugging load order.

Frequently asked questions

What database does ESX require?+

ESX Legacy requires a MySQL or MariaDB database. MariaDB is commonly used on Windows and Linux servers. You access and manage the database through a tool like HeidiSQL (Windows) or phpMyAdmin. The connection is provided to FiveM through the oxmysql resource using the mysql_connection_string convar.

What is oxmysql and why does ESX need it?+

oxmysql is a FiveM resource that provides a fast, modern MySQL interface for server-side Lua scripts. ESX Legacy replaced the older mysql-async library with oxmysql. You must ensure oxmysql before es_extended in your server.cfg or ESX will fail to start.

What does 'ensure' mean in server.cfg?+

'ensure resourceName' in server.cfg tells the FiveM server to start and keep running that resource. The order of ensure lines matters — oxmysql must come before es_extended, and es_extended must come before any ESX-dependent scripts.

Do I need OneSync for ESX Legacy?+

Yes. OneSync (set onesync on) is required for servers with more than 32 player slots and is expected by modern ESX scripts. Add it to your server.cfg along with set onesync_enableInfinity true for the full feature set on large servers.

How do I verify ESX installed correctly?+

After starting the server, open the server console and look for 'ESX Legacy started' without any database errors. Then connect with a FiveM client and type /cash or open a menu that relies on ESX. If your character spawns and job/money data loads, ESX is working correctly.

Ready-to-run FiveM packs

Skip the setup — grab 100k or die, Miami ghetto and NYC server packs from CRM Development.

Browse the shop

Related guides

ESXESX Legacyes_extendedoxmysqlFiveM setupserver.cfgFiveM installation