Many resources for FiveM require a database to function properly. Therefore, it is important that you correctly import the SQL files provided with your resources into your database so that the resources can create entries in your database and work as expected.
Not all resources require a database to function! When you download a resource, check the description or documentation to find out if you need to import an SQL file.
Often, one or more files with the .sql extension are included in the resource's download files. These need to be imported into the database.
In this example, we import the SQL file for ESX. You should prepare the SQL file for the resource you want to import it for. To do this, open the folder of your resource that requires a database and look for a file with the .sql extension.
Before proceeding with the import, open the .sql file with any text editor and check if the following lines are present:
If these lines are present in your .sql file, be sure to remove the
CREATEandUSEdatabase lines and save the file, otherwise the SQL file cannot be imported. The reason: The first line specifies that a new database should be created, which you do not need since your FiveM game server already has a database with a different name. The second line specifies that the database namedessentialmodeshould be used, which is also unnecessary because you are importing into an existing database.
Now you should open the Databases section in the dashboard of your game server.
On the database page, you will find various functions for managing your database, including options for backup, creation, management, and more. Here, we focus on accessing your database. For more information, feel free to check out our other database guides: External Database Access.
Click the blue redirect icon that takes you to the phpMyAdmin tool, where you can easily manage your database. Log in with the credentials shown on the database page if prompted.
On the page, select your database from the list on the left. The name of your database always starts with the prefix zap.
If you have not used the database yet, it will currently be empty. Now you can finally import the .sql file.
Click the Import button in the top navigation bar of phpMyAdmin to open the import menu.
Then click the Browse... button, which opens a file explorer. Select the .sql file you want to import.
The maximum file size is 2MB. If your SQL file is larger, you should use an SQL splitter to divide the large file into smaller parts. We recommend the tool Pinetools SQL-Splitter, which can help you with this. Afterwards, you can import the SQL files normally.
Finally, press the Import button at the bottom of the page to start the import. If everything worked, you will receive a success message and a new table will be created in your database, visible on the left.