In this tutorial, you'll learn how to integrate a MySQL database into your FiveM server using the MySQL-async resource via the Pterodactyl (VolticHost Game) panel. This setup is essential for storing persistent player data such as job records, inventories, and other roleplay information. π
π Prerequisites
-
A FiveM server purchased at VolticHost.com
-
Access to the Pterodactyl panel (a.k.a. VolticHost Game Panel)
-
Basic knowledge of server administration and file management
-
A MySQL database (contact your host or use a cloud MySQL service)
-
Familiarity with FiveM resource configuration
1οΈβ£ First Step - Installing MySQL-Async
-
Log in to VolticHost Game Panel.
-
Navigate to the File Manager and then to the
/resources/
directory. -
Upload or verify that the
mysql-async
resource folder is present. If it isnβt, download it from the official repository (e.g., MySQL-async GitHub) and upload it to the/resources/
folder.
β MySQL-async resource is installed successfully!
2οΈβ£ Next Step - Configuring the Database Connection
-
Open your
server.cfg
file located in the root directory using the File Manager. -
Add the following line to include the MySQL-async resource:
start mysql-async
-
Below that, add your database connection string. For example:
set mysql_connection_string "server=YOUR_DB_HOST;uid=YOUR_DB_USER;password=YOUR_DB_PASSWORD;database=YOUR_DB_NAME"
- Replace
YOUR_DB_HOST
,YOUR_DB_USER
,YOUR_DB_PASSWORD
, andYOUR_DB_NAME
with your actual database credentials.
- Replace
-
Save the changes to your
server.cfg
file.
β Database connection configured in server.cfg successfully!
3οΈβ£ Next Step - Restarting and Testing the Connection
-
Return to the main dashboard of the VolticHost Game Panel and restart your server to apply the new configuration.
-
Once the server is up, check the server console/logs to ensure there are no errors related to MySQL-async.
-
(Optional) Create or use an existing resource that queries the database. For example, add a simple command in a custom resource that uses MySQL-async to retrieve data and prints it in the console:
-- Example: In a custom server script RegisterCommand("testdb", function(source, args, rawCommand) MySQL.Async.fetchScalar('SELECT COUNT(*) FROM users', {}, function(result) print("Total users in the database: " .. tostring(result)) end) end, false)
-
Execute the command (
/testdb
) in-game or via the console to verify that data is being retrieved from your database.
β Database connection tested and functioning correctly!
π Conclusion
You have now successfully set up a database connection on your FiveM server using MySQL-async via the Pterodactyl panel! This integration ensures that your server can store and retrieve persistent player data, which is critical for a dynamic and immersive roleplay experience. π
For more assistance, contact VolticHost Support.