This guide will help you setup:
- FXServer and how to configure it for SQL/Essentialmode4
- MySQL for Windows
- Serverstarter.bat file
- Installing Essentialmode4
- Installing MySQL-Async
- Installing esplugin_mysql
- importing a .sql database into your MySQL Server
Download the MySQL Community edition from here from the windows mysql installer or just google ‘Download SQL Community Edition’
In that link there are two options, use the top one its 1.7mb and is an auto-installer just keep everything default. It might ask what MySQL tools you want to install. I clicked full install, it might ask you to install python you can ignore it. In the end it will want you to install the example sql files I just canceled the setup for that and moved on you don’t need it.
This link was pretty helpful with pictures but kinda dated, the MySQL Server + MySQL Workbench is recommended if you choose custom install. This is a step-by-step guide for the install
There are lots of different MySQL ‘workbench’ apps that create an easy to use interface for viewing and managing your SQL database. I HIGHLY recommend you install the MySQL workbench included with the installer or get your own, you won’t have to use that windows CMD console to manage your stuff as pictured in the guide.
Now that MySQL is installed we have some ground work to take care of before we can get our server launched and essentialmode running. If you already have FXServer running you can skip this part of the guide.
Lets create a .bat file so we can easily start our server and load resources.
I use Notepad++ for this I recommend you download that too.
- Make a new text file
- Save it as .bat file | File > Save As> Save As Type: All Files (All Types .)
- File Name: serverstarter.bat
- Click save
- Go to your new .bat file, right click and edit it with notepad++
- Paste this text and then paste your FXServer file location into the text.
cd C:\Users\Server\Desktop\FXServer C:\Users\Server\Desktop\FXServer\run.cmd +exec server.cfg
Once that is pasted in, save the file and now double click the “serverstarter.bat” file to boot your server.
Again, C:\Users\Server\Desktop\FXServer is my FXServer file location, you need to replace this with the file path YOU have FXServer installed to.
Now we need to create a server.cfg file so we can tell the server our settings and what resources to start up.
Go here and copy+paste the server.cfg that the devs were kind enough to supply us with.
Make sure the server.cfg file is in your FXServer folder.
Boot your server up so it creates the citizen, resources, and cache folders in your FXServer folder.
If you double click the serverstarter.bat file and it flickers but nothing happens you need to read my instructions again.
Now that we have a running server we can get essentialmode installed on it.
Download the latest essentialmode from the forums here.
- Extract the .rar so we can access the ‘essentialmode’ folder and ‘es_admin2’ folder.
- Paste the ‘essentialmode’ folder into your FXServer/resources folder.
- Paste the ‘es_admin2’ folder into your FXServer/resources/[essential] folder. If that doesn’t exist see step 4.
- If there is no ‘[essential]’ folder just make a new folder and name it [essential] with the brackets, then paste the ‘es_admin2’ folder into it. So it should be FXServer/resources/[essential]/es_admin2 as the final file path.
- Edit your server.cfg file and add start essentialmode and start es_admin2
It should look like this:
# Starting server basics start mapmanager start chat start spawnmanager start fivem start hardcap start ■■■■■■■ start scoreboard # Starting Essentialmode start essentialmode start es_admin2
You shouldn’t need to edit anything inside the essentialmode .lua files. We are almost done but now we need to install and configured mysql-async before we can use the essentialmode-MySQL_plugin.
Download MySQL-Async-Library from the FiveM Forums
mysql-async-library for fxserver
- Extract the folder and it should be named ‘fivem-mysql-async-2.xx’
- Rename the folder from ‘fivem-mysql-async-2.xx’ to mysql-async this is very important!
- We need to edit our server.cfg file again so open that again.
- Paste the following into your server.cfg file:
set mysql_connection_string "server=127.0.0.1;database=essentialmode;userid=root;password=PASSWORD" # Initialize System Main Files start mapmanager start chat start spawnmanager start fivem start hardcap start ■■■■■■■ start scoreboard # Starting Mysql-async start mysql-async start essentialmode start es_admin2
This will enable mysql-async and tell it to use our essentialmode database in MySQL.
Be sure to replace password=PASSWORD with your password!
set mysql_connection_string "server=127.0.0.1;database=essentialmode;userid=root;password=YourPassword"
^^^ This line is very important, you need to place this above essentialmode stuff and your system main files.
That’s all we will need for mysql-async, now we will download the plugin for essentialmode that enables it for MySQL and we can get our database imported.
Download esplugin_mysql from the forums you may need to scroll down to where it says "Custom data plugins"
Make sure you have MySQL-Async installed and working before installing esplugin!
esplugin_mysql for essentialmode
- Extract the file so we can access the esplugin_mysql file
- Paste the esplugin_mysql file into your FXServer/resources folder
- Edit your server.cfg file with the following info
set es_enableCustomData 1 set mysql_connection_string "server=127.0.0.1;database=essentialmode;userid=root;password=PASSWORD" # Initialize System Main Files start mapmanager start chat start spawnmanager start fivem start hardcap start ■■■■■■■ start scoreboard # Starting Mysql-async start mysql-async start essentialmode start esplugin_mysql start es_admin2
we added set es_enableCustomData 1 to the top of our server.cfg
and we added the start esplugin_mysql
We just need to import the .sql database and your server should be ready to go!
Now open your MySQL server through the MySQL Workbench (has a dolphin icon) you can import the ‘.sql’ script that comes with the esplugin_mysql download. Follow this youtube video to import the script into your sql database. Be sure to click refresh to see that your SCHEMAS has been updated after running the script.
The .sql file is located in the esplugin_mysql folder
If it asks you to name the database you can leave it blank and the script should name it essentialmode automatically. If the database won’t name itself then call it essentialmode
That’s it you’re done, if you were switching from couchdb you may need to tell your scripts to use mysql-async
This is not a help thread, you won’t recieve support here if something is wrong. This is merely a guide to help out people who are new to setting up servers and installing these resources. Always go one step at a time, test each new resource one at a time, and always make a backup before you make edits.
If something is wrong with my tutorial let me know and I can fix it.