Skip to main content

FiveM: Resolve Database Connection issues

This guide was created with the following products:

(Details may vary with products from different providers but the main concepts remain the same)

Introduction

Oxmysql is a useful open-source FiveM resource that comes pre-installed with your FiveM server, to allow communication between the server and your database. During development, it is possible that you may perform changes (such as refreshing database credentials) that will require changes to the oxmysql connection string. Example of database connection issue:

In this guide, we will explore the methods for resolving database connection issues on your FiveM server by adjusting the connection string in your server configuration file.

Automatic Method

Begin by opening your server's web interface panel on the website and head over to the Settings section.

img

On this page, scroll to the bottom where you will be able to find the Actions buttons. Simply use the Reconfigure MySQL connection string button and once pressed, restart your server to ensure the changes are processed.

This will automatically update your server.cfg file with the correct current credentials, meaning your database should start functioning again.

Manual Method

In order to resolve this manually, you will require access to your server.cfg file where you will adjust the connection string manually with the credentials provided on your web interface panel. Log in to the txAdmin interface and open the CFG editor. Now in another tab, head over to the Tools->Databases section where you will be able to view your existing credentials.

In your server.cfg file, add the following line (or replace it if it exists already), filling in the details with your own database credentials found on the web interface.

set mysql_connection_string "mysql://USER:PASSWORD@SERVER:3306/DATABASE"

Once this has been completed, make sure to save the file and restart your server.

Conclusion

The next time the server launches, your database should be accessible again by your server and thus should fully function. You have successfully resolved your database connection issues. For further questions or assistance, please don't hesitate to contact our support team, which is available daily to assist you! 🙂