[{"data":1,"prerenderedAt":29},["ShallowReactive",2],{"doc-en-connect-mysql-fivem-server":3},{"path":4,"slug":5,"title":6,"description":7,"category":8,"subcategory":9,"icon":10,"date":11,"author":12,"order":13,"image":14,"tags":15,"keywords":20,"docGroup":26,"docGroupIcon":26,"link_fr":27,"bodyHtml":28},"\u002Fdocs\u002Fen\u002Fgaming\u002Ffivem\u002Fconnect-mysql-fivem-server","connect-mysql-fivem-server","How to connect your FiveM server to a MySQL database","Set up the MySQL connection for your FiveM server at Winheberg, connection string, password security, and fixes for common errors.","jeux","fivem","tabler:file-text","2026-07-24","Winheberg",15,"\u002Fstatics\u002Fimages\u002Fdocs\u002Fen\u002Fgaming\u002Ffivem\u002Fconnect-mysql-fivem-server.webp",[9,16,17,18,19],"mysql","database","oxmysql","configuration",[21,22,23,24,25],"fivem mysql","fivem database connection","oxmysql setup","mysql_connection_string","fivem server winheberg","","\u002Fdocs\u002Ffivem\u002Fconnexion-mysql-serveur-fivem","\u003Ch2>Context\u003C\u002Fh2>\n\u003Cp>You manage a \u003Cstrong>FiveM server\u003C\u002Fstrong> (GTA RP) and want to connect it to a \u003Cstrong>MySQL database\u003C\u002Fstrong> to store player accounts, inventory, vehicles, money, or any other persistent data? Whether you use \u003Cstrong>oxmysql\u003C\u002Fstrong>, \u003Cstrong>ghmattimysql\u003C\u002Fstrong>, or another connector, the configuration always goes through the same \u003Ccode>mysql_connection_string\u003C\u002Fcode> variable in your \u003Ccode>server.cfg\u003C\u002Fcode>.\u003C\u002Fp>\n\u003Cp>This guide walks you through setting up this connection correctly, with security best practices and fixes for the most common errors.\u003C\u002Fp>\n\u003Cdiv class=\"markdown-alert markdown-alert-important\">\u003Cspan class=\"alert-icon\">\u003Csvg xmlns=\"http:\u002F\u002Fwww.w3.org\u002F2000\u002Fsvg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\u003Cpath d=\"M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10z\"\u002F>\u003Cpath d=\"M12 8v4\"\u002F>\u003Cpath d=\"M12 16h.01\"\u002F>\u003C\u002Fsvg>\u003C\u002Fspan>\u003Cdiv class=\"markdown-alert-body\">\u003Cp>Make sure sensitive information such as passwords stays secure and isn&#39;t shared publicly. Never commit your \u003Ccode>server.cfg\u003C\u002Fcode> to a public Git repository, even temporarily.\u003C\u002Fp>\n\u003C\u002Fdiv>\u003C\u002Fdiv>\n\u003Ch2>Prerequisites\u003C\u002Fh2>\n\u003Cp>Before you start, make sure you have the following.\u003C\u002Fp>\n\u003Cul>\n\u003Cli>An active \u003Cstrong>FiveM server\u003C\u002Fstrong> on your Winheberg gaming panel\u003C\u002Fli>\n\u003Cli>A \u003Cstrong>MySQL connector\u003C\u002Fstrong> installed on your FiveM server (oxmysql, ghmattimysql, mysql-async, etc.)\u003C\u002Fli>\n\u003C\u002Ful>\n\u003Ch2>1. Create a database from the gaming panel\u003C\u002Fh2>\n\u003Cp>Your database is created directly from the \u003Cstrong>Winheberg gaming panel\u003C\u002Fstrong>, in your FiveM server&#39;s dedicated section.\u003C\u002Fp>\n\u003Col>\n\u003Cli>Log in to your \u003Cstrong>Winheberg gaming panel\u003C\u002Fstrong>\u003C\u002Fli>\n\u003Cli>Go to your FiveM server\u003C\u002Fli>\n\u003Cli>Open the \u003Cstrong>Databases\u003C\u002Fstrong> tab\u003C\u002Fli>\n\u003Cli>Click \u003Cstrong>Create Database\u003C\u002Fstrong> (or equivalent) to create a new one\u003C\u002Fli>\n\u003C\u002Fol>\n\u003Cimg src=\"\u002Fstatics\u002Fimages\u002Fdocs\u002Fen\u002Fgaming\u002Ffivem\u002Fconnect-mysql-fivem-server-1779545714832-dbc8aa8fc6367a6a869e8ad4.webp\" alt=\"Screenshot of the gaming panel's Databases tab with the Create Database button\" width=\"800\" \u002F>\n\n\u003Cp>Once the database is created, you&#39;ll get a database name, a username, and a password. This information will appear immediately in the databases table.\u003C\u002Fp>\n\u003Cimg src=\"\u002Fstatics\u002Fimages\u002Fdocs\u002Fen\u002Fgaming\u002Ffivem\u002Fconnect-mysql-fivem-server-1779546184099-9bf5177916be09045aa783f5.webp\" alt=\"Screenshot of the summary table after creation (Name, Username, Endpoint)\" width=\"800\" \u002F>\n\n\u003Ch2>2. Get the ready-to-use connection string\u003C\u002Fh2>\n\u003Cp>To make things easier, Winheberg automatically generates the \u003Cstrong>full connection string\u003C\u002Fstrong> in the \u003Cstrong>Database Details\u003C\u002Fstrong> section.\u003C\u002Fp>\n\u003Col>\n\u003Cli>Click your freshly created database\u003C\u002Fli>\n\u003Cli>Scroll down to the \u003Cstrong>Database Details\u003C\u002Fstrong> section\u003C\u002Fli>\n\u003Cli>Find the \u003Cstrong>Fxserver Database\u003C\u002Fstrong> line, which contains the \u003Ccode>mysql_connection_string\u003C\u002Fcode> ready to copy\u003C\u002Fli>\n\u003C\u002Fol>\n\u003Cimg src=\"\u002Fstatics\u002Fimages\u002Fdocs\u002Fen\u002Fgaming\u002Ffivem\u002Fconnect-mysql-fivem-server-1779545831004-15e546e228cb9281253bcccd.webp\" alt=\"Screenshot of the Database Details button\" width=\"800\" \u002F>\n\n\u003Cimg src=\"\u002Fstatics\u002Fimages\u002Fdocs\u002Fen\u002Fgaming\u002Ffivem\u002Fconnect-mysql-fivem-server-1779545902055-32b4b4047822492c6df3be3c.webp\" alt=\"Screenshot of the Database Details section with the Fxserver Database line\" width=\"800\" \u002F>\n\n\u003Cp>This line looks like this.\u003C\u002Fp>\n\u003Cpre>\u003Ccode class=\"language-bash\">set mysql_connection_string &quot;server=dbXX.wh-nodes.net;database=sxx_Exemple;userid=uxxx_Exemple;password=PASSWORD&quot;\n\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Cp>You just need to copy it into your \u003Ccode>server.cfg\u003C\u002Fcode>.\u003C\u002Fp>\n\u003Cdiv class=\"markdown-alert markdown-alert-warning\">\u003Cspan class=\"alert-icon\">\u003Csvg xmlns=\"http:\u002F\u002Fwww.w3.org\u002F2000\u002Fsvg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\u003Cpath d=\"M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z\"\u002F>\u003Cline x1=\"12\" y1=\"9\" x2=\"12\" y2=\"13\"\u002F>\u003Cline x1=\"12\" y1=\"17\" x2=\"12.01\" y2=\"17\"\u002F>\u003C\u002Fsvg>\u003C\u002Fspan>\u003Cdiv class=\"markdown-alert-body\">\u003Cp>If your password contains characters like \u003Ccode>=\u003C\u002Fcode>, \u003Ccode>;\u003C\u002Fcode>, \u003Ccode>&quot;\u003C\u002Fcode>, or \u003Ccode>&#39;\u003C\u002Fcode>, parsing the connection string will fail (especially with OXMYSQL). If that happens, \u003Cstrong>regenerate the password\u003C\u002Fstrong> from the panel (the \u003Cstrong>Rotate password\u003C\u002Fstrong> option or equivalent) until you get a clean password. See the &quot;Password containing problematic characters&quot; section below.\u003C\u002Fp>\n\u003C\u002Fdiv>\u003C\u002Fdiv>\n\u003Ch2>3. Add the string to server.cfg\u003C\u002Fh2>\n\u003Cp>Open your \u003Ccode>server.cfg\u003C\u002Fcode> file (at the root of your FiveM server) and \u003Cstrong>paste the line\u003C\u002Fstrong> you just copied from the panel.\u003C\u002Fp>\n\u003Cpre>\u003Ccode class=\"language-bash\">set mysql_connection_string &quot;server=dbXX.wh-nodes.net;database=sxx_Exemple;userid=uxxx_Exemple;password=YOUR_PASSWORD&quot;\n\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Cp>If the \u003Ccode>mysql_connection_string\u003C\u002Fcode> line already exists in your \u003Ccode>server.cfg\u003C\u002Fcode>, \u003Cstrong>replace it\u003C\u002Fstrong> entirely with the new one.\u003C\u002Fp>\n\u003Ch2>4. Restart your FiveM server\u003C\u002Fh2>\n\u003Cp>After saving the changes, \u003Cstrong>fully restart your server\u003C\u002Fstrong> so the new configuration takes effect. A simple resource \u003Ccode>restart\u003C\u002Fcode> isn&#39;t enough, since \u003Ccode>mysql_connection_string\u003C\u002Fcode> is loaded when the server starts.\u003C\u002Fp>\n\u003Ch2>5. Check the connection\u003C\u002Fh2>\n\u003Cp>Once the server has restarted, check the FiveM logs. If the connection works, you should see a message like this.\u003C\u002Fp>\n\u003Cpre>\u003Ccode>[oxmysql] Database server connection established!\n\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Cp>If you see an error instead, check the &quot;If you run into trouble&quot; section at the end of this guide.\u003C\u002Fp>\n\u003Ch2>Password containing problematic characters\u003C\u002Fh2>\n\u003Cp>Some special characters (\u003Ccode>=\u003C\u002Fcode>, \u003Ccode>;\u003C\u002Fcode>, \u003Ccode>&quot;\u003C\u002Fcode>, \u003Ccode>&#39;\u003C\u002Fcode>) are used in the \u003Cstrong>syntax itself\u003C\u002Fstrong> of the \u003Ccode>mysql_connection_string\u003C\u002Fcode> and will break the string&#39;s parsing. This is especially true with \u003Cstrong>OXMYSQL\u003C\u002Fstrong>, which is very strict.\u003C\u002Fp>\n\u003Cp>If your password contains one of these characters, the simplest solution is to \u003Cstrong>regenerate the password\u003C\u002Fstrong> from the panel.\u003C\u002Fp>\n\u003Col>\n\u003Cli>Go back to the \u003Cstrong>Databases\u003C\u002Fstrong> tab on the gaming panel\u003C\u002Fli>\n\u003Cli>Click your database\u003C\u002Fli>\n\u003Cli>Use the \u003Cstrong>Rotate password\u003C\u002Fstrong> option (or equivalent)\u003C\u002Fli>\n\u003Cli>Check that the new password doesn&#39;t contain any of the problematic characters\u003C\u002Fli>\n\u003Cli>If needed, rotate again until you get a clean password\u003C\u002Fli>\n\u003Cli>Get the updated \u003Cstrong>Fxserver Database\u003C\u002Fstrong> string again from \u003Cstrong>Database Details\u003C\u002Fstrong>\u003C\u002Fli>\n\u003Cli>Replace it in your \u003Ccode>server.cfg\u003C\u002Fcode> and restart your server\u003C\u002Fli>\n\u003C\u002Fol>\n\u003Ch2>Security best practices\u003C\u002Fh2>\n\u003Cp>A few rules to follow to keep your MySQL connection secure.\u003C\u002Fp>\n\u003Cul>\n\u003Cli>\u003Cstrong>Never share your \u003Ccode>server.cfg\u003C\u002Fcode>\u003C\u002Fstrong> on public forums or GitHub, it contains your MySQL password in plain text\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Regenerate your password\u003C\u002Fstrong> from the panel if you suspect a leak, for example if you accidentally shared your \u003Ccode>server.cfg\u003C\u002Fcode>\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Make regular backups\u003C\u002Fstrong> of your database with \u003Ccode>mysqldump\u003C\u002Fcode> or through the panel\u003C\u002Fli>\n\u003Cli>\u003Cstrong>Don&#39;t give panel access\u003C\u002Fstrong> to unauthorized people, they could see your MySQL password in plain text in Database Details\u003C\u002Fli>\n\u003C\u002Ful>\n\u003Ch2>If you run into trouble\u003C\u002Fh2>\n\u003Cp>Here are the most common errors you might run into.\u003C\u002Fp>\n\u003Ch3>❌ Access denied for user\u003C\u002Fh3>\n\u003Cp>The username or password is incorrect. Check the following.\u003C\u002Fp>\n\u003Cul>\n\u003Cli>That you correctly copied the full line from \u003Cstrong>Database Details\u003C\u002Fstrong> without truncating it\u003C\u002Fli>\n\u003Cli>That the password doesn&#39;t contain forbidden characters (\u003Ccode>=\u003C\u002Fcode>, \u003Ccode>;\u003C\u002Fcode>, \u003Ccode>&quot;\u003C\u002Fcode>, \u003Ccode>&#39;\u003C\u002Fcode>), if it does, regenerate it from the panel\u003C\u002Fli>\n\u003Cli>That there&#39;s no extra space before or after the values in your \u003Ccode>mysql_connection_string\u003C\u002Fcode>\u003C\u002Fli>\n\u003C\u002Ful>\n\u003Ch3>❌ Can&#39;t connect to MySQL server\u003C\u002Fh3>\n\u003Cp>FiveM can&#39;t reach the MySQL server. Check the following.\u003C\u002Fp>\n\u003Cul>\n\u003Cli>That the server address (\u003Ccode>dbXX.wh-nodes.net\u003C\u002Fcode>) is spelled correctly in your \u003Ccode>mysql_connection_string\u003C\u002Fcode>\u003C\u002Fli>\n\u003Cli>That your database is active in the gaming panel, not suspended or deleted\u003C\u002Fli>\n\u003Cli>That your FiveM server has outbound network access, normally always the case at Winheberg\u003C\u002Fli>\n\u003C\u002Ful>\n\u003Ch3>❌ The server starts but no data is being saved\u003C\u002Fh3>\n\u003Cp>Check the FiveM logs at startup. You&#39;ll likely see a silent connection error. If you&#39;re using oxmysql, run the following command in the FiveM console to enable debug mode.\u003C\u002Fp>\n\u003Cpre>\u003Ccode>oxmysql_debug true\n\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Cp>This will enable detailed MySQL query logs and help you identify the issue.\u003C\u002Fp>\n\u003Ch3>❌ Unknown collation &#39;utf8mb4_0900_ai_ci&#39;\u003C\u002Fh3>\n\u003Cp>This error happens when you import a database exported from MySQL 8 into MariaDB. Before importing, replace every occurrence of \u003Ccode>utf8mb4_0900_ai_ci\u003C\u002Fcode> with \u003Ccode>utf8mb4_unicode_ci\u003C\u002Fcode> in your SQL file.\u003C\u002Fp>\n\u003Ch2>Need help?\u003C\u002Fh2>\n\u003Cp>If your FiveM server still won&#39;t connect to MySQL despite these steps, our team is here. Open a ticket in the \u003Cstrong>Technical\u003C\u002Fstrong> department from your client area, fill in the \u003Cstrong>Produit lié\u003C\u002Fstrong> field with the server in question, and attach your FiveM server&#39;s startup logs.\u003C\u002Fp>\n\u003Cp>Your FiveM server is now connected to its database and ready to save your players&#39; data 🎮\u003C\u002Fp>\n",1788993140901]