Connect your server to a database
Overview
Most frameworks (ESX, QBCore, etc.) store their data in MySQL. Other resources may require a different configuration - always read the resource documentation.
Step-by-Step Instructions
<ol><li>Create a database and import all the SQL files that came with your resources first.</li><li>Open server.cfg.</li><li>Add the mysql_connection_string at the top of the file.</li><li>Replace HOST, USERNAME, PASSWORD and DBNAME with your real values (found under Databases in the panel).</li><li>Save the file and restart your server.</li></ol>
Code / Configuration
<pre><code>set mysql_connection_string "server=DB_HOST_IP;uid=DB_USER;password=DB_PASS;database=DB_NAME"</code></pre>
Watch the database IP
Use the IP from the Databases tab, never 127.0.0.1. A wrong IP causes the ECONNREFUSED error.
FAQ
Related Tutorials
From the Blog
Was this guide helpful?
Join our Discord for more guides and direct help from our engineering team.
