How to install ESX Legacy on a FiveM server: recipe and manual

Install ESX Legacy with a txAdmin recipe or by hand: es_extended, core resources, oxmysql, SQL import, server.cfg order, first login checks and the first errors.

You want a FiveM server running ESX Legacy, and you want to know which way to install it. There are two: a txAdmin recipe, which does everything, and a manual install, where you place each piece yourself. This guide covers both, then what to check on your first login and the errors you are most likely to see.

Option 1: the txAdmin recipe

This is the recommended route. In txAdmin's setup, pick the ESX Legacy template from the popular recipes. Follow the steps in txAdmin setup and recipes: enter your license key and database credentials, then review the generated server.cfg and start the server.

The recipe downloads es_extended and the core resources, oxmysql and ox_lib, creates the database and imports the ESX SQL file. When you finish, you have a working base. Skip to "First login checks".

Option 2: manual install

Do this when you add ESX to a server you built yourself. You need a running FXServer, a MySQL or MariaDB database and a license key.

1. Download the resources

From the ESX Legacy releases, get the core pack (es_extended and the core resources it uses, such as the identity, menu and notification resources). Put them in your resources folder, for example in resources/[esx]. You also need:

  • oxmysql, the database layer.
  • ox_lib, a common dependency for modern ESX resources.
  • An inventory. Many ESX Legacy servers use ox_inventory. Follow the documentation of the version you download, because the default setup can change between releases.

2. Create the database and import the SQL

Create an empty database, for example esx:

sql
CREATE DATABASE esx CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

Then import the SQL file that ships with es_extended (look for a .sql file in its folder, named legacy.sql at the time of writing). Use HeidiSQL, phpMyAdmin or the mysql command line. Without it, you will meet table doesn't exist errors.

3. Edit server.cfg

Set the connection string and start the resources in a good order:

cfg
set mysql_connection_string "mysql://user:password@localhost/esx?charset=utf8mb4"

ensure oxmysql
ensure ox_lib
ensure es_extended
ensure ox_inventory
ensure [esx]
ensure [standalone]

The order is explained in server.cfg ensure order. If you use the ESX identity or multicharacter resources, make sure only one character selection resource runs.

First login checks

Start the server and read the console from top to bottom before you join. Then check:

  1. oxmysql connects. There is a line about the database connection and no red error right after it.
  2. es_extended starts with no errors.
  3. You can join and reach the character creation or spawn.
  4. Your player row exists. After you join, you should see a row for yourself in the users table.
  5. Money and job load. Open your inventory or run a command that prints your account and job.

For admin rights, set your group to admin in your users row, then rejoin. For txAdmin and ACE commands, see ACE permissions.

Common first errors

ESX is nil in a script. A resource that still uses an old way to get ESX shows:

text
attempt to index a nil value (global 'ESX')

The modern way is ESX = exports['es_extended']:getSharedObject(). See ESX is nil: fixing esx:getSharedObject and no such export getSharedObject in es_extended.

Cannot connect to the database. The connection string is wrong, the database is not running, or the user has no rights. See oxmysql connection error.

A resource does not start. Often a missing dependency or a wrong folder name. See could not find dependency and couldn't start resource.

Players stuck on loading. Look at the console for the resource that errors during join. See players stuck on the loading screen.

Tip: when you add a script, add one at a time and restart. If an error appears, you know which script caused it.

Adding jobs and items

Once the base works, the next tasks are jobs and items. Add a job on ESX shows the database rows you need. For items, the way depends on your inventory: see ox_inventory add items.

Checklist

Symptom Fix
Table doesn't exist Import the ESX SQL file into the database named in the connection string
attempt to index a nil value (global 'ESX') Use exports['es_extended']:getSharedObject() and start es_extended first
Cannot connect to the database Check mysql_connection_string, the database service and the user rights
Two character screens Run only one identity or multicharacter resource
Not admin in game Set group to admin in your users row, then rejoin
Resource not found Check the folder name and run refresh in the console

Quick answers

Should I install ESX Legacy with a recipe or by hand?

Use the txAdmin recipe. It downloads matching versions, creates the database and writes server.cfg for you. Install by hand only if you need full control or are adding ESX to an existing server.

Do I need oxmysql for ESX Legacy?

Yes. ESX Legacy talks to the database through oxmysql, so it must start before es_extended.

How do I make myself admin on ESX?

Set your group to admin, usually in the group column of your row in the users table, then rejoin. You can also add your identifier to the server's ACE permissions for txAdmin and commands.

Scripts that skip this problem

Item Creator V2Create usable items with animations, props, effects and more β€” without writing code.View script β†’Shop CreatorBuild a shop in under a minute β€” owners, employees, vaults and robberies included.View script β†’Mic PhoneA foldable phone that unfolds into a tablet and carries onto a player's real phone.View script β†’

Keep reading