This guide details how to set up and connect your FiveM server to a database for popular frameworks like ESX or QB-Core on CloudNord. We'll walk you through using a remote database client like HeidiSQL to manage your database effectively.
Note: This article assumes you have already followed the CloudNord FiveM Server Setup Guide and have your basic FiveM server and txAdmin running.
Part 1: Create Your Database on CloudNord
CloudNord's Game Panel makes creating the database for your FiveM framework straightforward. The necessary MariaDB/MySQL service is already running on your game instance.
- Log In to CloudNord Panel: Go to your CloudNord Game Panel and select your FiveM server.
- Navigate to "Databases": On the left-hand sidebar, click on the "Databases" tab.
- Create New Database:
- Click the "Create New Database" button.
- Database Name: Enter a descriptive name for your database (e.g.,
esx_db
,qbcore_main_db
,myrp_database
). - Connections: Leave this as
%
. This wildcard allows connections from any host, which is necessary for remote tools like HeidiSQL to connect. - Click "Create Database".
- Record Credentials: Once created, your new database will be listed. Carefully note down the following critical details. You will need these to connect remotely:
- Database Name (e.g.,
s0_esx_db
- note that the panel often adds a prefix likes0_
to your chosen name) - Username (e.g.,
u0_dbuser
) - Password (Click the eye icon to reveal it, or the refresh icon to generate a new one. Do not lose this password!)
- Host for Remote Connection: For connecting with a remote tool like HeidiSQL, you will use your FiveM server's public IP address and the database port (typically 3306 or 3307). You can find your server's public IP in the "Console" or "SFTP Details" tab of your CloudNord Game Panel.
- Database Name (e.g.,
Part 2: Connect with a Remote Database Client (e.g., HeidiSQL) & Import SQL
You will use a desktop client to connect to your database and import the necessary SQL schemas. HeidiSQL is a popular, free option (Windows only).
2.1: Download and Install HeidiSQL (or similar client)
If you don't have one, download and install HeidiSQL:
- Go to the HeidiSQL Download Page.
- Download and install the latest stable version for Windows. (For macOS or Linux, consider alternatives like DBeaver or MySQL Workbench.)
2.2: Connect to Your CloudNord Database Remotely
Open HeidiSQL and create a new session to connect to your database using the credentials from Part 1.
- Open HeidiSQL. Click on the "New" button (the green circle with a plus sign).
- Session Name: Give your session a memorable name (e.g., "CloudNord FiveM DB").
- Fill in the connection details using the credentials you recorded in Part 1, Step 4:
- Network type: MySQL (TCP/IP)
- Hostname / IP: Your databases IP address (found in your CloudNord Game Panel). This is your endpoint before the colon sign. Will look like <host>:<port> on the game panel databases tab.
- User: Your database Username (e.g.,
u0_dbuser
) - Password: Your database Password
- Port: Typically
3306. <host>:<port>
- Databases: Enter your specific Database Name (e.g.,
s0_esx_db
)
- Click "Open" to connect. If successful, you will see your database listed on the left sidebar.
2.3: Import Your Framework's SQL Schema
Now, import the .sql
files that define your FiveM framework's database structure.
- Locate & Download SQL Files: Access your FiveM server's "File Manager" in the CloudNord Game Panel. Navigate to your framework's resource folder (e.g.,
resources/[esx]/es_extended/
for ESX, or your QB-Core core folder). Download all necessary.sql
files (e.g.,es_extended.sql
, `vehicles.sql`, `items.sql`) to your local computer. - Import into HeidiSQL:
- In HeidiSQL, ensure your database (e.g.,
s0_esx_db
) is selected in the left sidebar. - Go to the menu File > Load SQL file... (or press F7).
- Select one of the downloaded
.sql
files from your local computer and open it. - A new tab will open with the SQL query. Click the "Run" button (the blue play icon in the toolbar) to execute the script.
- Confirm success messages or check for any errors reported by HeidiSQL.
- In HeidiSQL, ensure your database (e.g.,
- Repeat for all necessary SQL files: Continue this process until all required SQL schemas for your FiveM framework are imported into your database.
Part 3: Configure Your FiveM server.cfg
to Connect
Finally, you need to update your FiveM server's configuration file to point to your new database using the credentials you obtained from the CloudNord Game Panel.
- Access File Manager: Go back to your CloudNord Game Panel and click the "File Manager" tab for your FiveM server.
- Edit
server.cfg
: Navigate to the root of your server's directory and find yourserver.cfg
file. Click on it to open the editor. - Add Database Connection String:
- Add a new line, or locate an existing `mysql_connection_string` line if present.
- Enter the following connection string, ensuring you use the exact Database Name, Username, and Password from Part 1, Step 4:
# Database connection for MySQL/MariaDB hosted on this server set mysql_connection_string "mysql://YOUR_USERNAME:YOUR_PASSWORD@localhost/YOUR_DATABASE_NAME?charset=utf8mb4"
- Example (using typical CloudNord database name/username format):
set mysql_connection_string "mysql://u0_dbuser:YOUR_PASSWORD_HERE@localhost/s0_esx_db?charset=utf8mb4"
- Important Notes for the Connection String:
- Replace
YOUR_USERNAME
with your actual database username (e.g.,u0_dbuser
). - Replace
YOUR_PASSWORD_HERE
with the password you recorded in Part 1, Step 4 (it is case-sensitive!). - Replace
YOUR_DATABASE_NAME
with your actual database name (e.g.,s0_esx_db
). localhost
is correct here because your FiveM server is connecting to the database service on the same server instance.?charset=utf8mb4
is crucial for proper character handling, especially for emojis and special characters.
- Replace
- Save Changes: After making the necessary edits, click the "Save Content" button in the File Manager.
- Restart Your FiveM Server:
- Return to your server's "Console" tab.
- Click the "Restart" button to apply all the changes you've made.
- Monitor the console for messages from your FiveM framework.
Part 4: Verify Your Connection and Framework Status
After your server restarts, it's important to confirm that everything is connected and your framework is running as expected.
- Check Console for Database Connection:
- Observe your server's "Console" tab. If configured correctly, your FiveM framework should output messages indicating a successful database connection (e.g.,
[MySQL] Connected to database
).
- Observe your server's "Console" tab. If configured correctly, your FiveM framework should output messages indicating a successful database connection (e.g.,
- Check in-game: Join your FiveM server. If your framework is installed and configured correctly, you should be able to register, and your data (money, inventory, etc.) should persist after leaving and rejoining.
- Troubleshooting Connection Errors:
- If you see errors like "Failed to connect to MySQL", "Access Denied", or similar database connection issues:
- Double-check
server.cfg
: Carefully review your `mysql_connection_string` in `server.cfg`. Ensure your database username, password, and database name are absolutely correct and match what you noted in Part 1, Step 4. Pay close attention to capitalization and any typos. - HeidiSQL Connection: Ensure you can still connect to your database using HeidiSQL with the exact same credentials. If not, the issue might be with the credentials or the database service.
- Database Import: Re-verify that all necessary `.sql` files for your framework were successfully imported into your database via HeidiSQL.
- Double-check
- If you see errors like "Failed to connect to MySQL", "Access Denied", or similar database connection issues:
You've now successfully set up your FiveM server's database and connected it for framework use on your CloudNord instance! Your server will now be able to leverage the full features of your chosen FiveM framework and resources. If you have any further questions or encounter persistent issues, please reach out to CloudNord Support for assistance.