{"id":21560,"date":"2026-06-08T10:28:47","date_gmt":"2026-06-08T10:28:47","guid":{"rendered":"https:\/\/xgamingserver.com\/blog\/fivem-database-setup\/"},"modified":"2026-06-08T10:28:47","modified_gmt":"2026-06-08T10:28:47","slug":"fivem-database-setup","status":"publish","type":"post","link":"https:\/\/xgamingserver.com\/blog\/fivem-database-setup\/","title":{"rendered":"FiveM Database Setup: MySQL\/MariaDB &#038; oxmysql Guide"},"content":{"rendered":"<p>Almost every serious FiveM server needs a database. Frameworks like ESX, QBCore and QBox store players, characters, money, vehicles and inventories in MySQL\/MariaDB &mdash; so getting the database right is a core setup step. This guide covers how to set up a database for FiveM.<\/p>\n<h2>MySQL or MariaDB?<\/h2>\n<p>Either works, and the FiveM community largely uses <strong>MariaDB<\/strong> (a drop-in MySQL fork) for performance. The connection details are identical from FiveM&#8217;s point of view. Your host may provide one for you; if you self-host, install MariaDB and a management tool like <strong>HeidiSQL<\/strong> or phpMyAdmin to work with it visually.<\/p>\n<h2>Step 1: Create the database<\/h2>\n<ol>\n<li>Open your database tool (HeidiSQL\/phpMyAdmin) and connect to your MySQL\/MariaDB server.<\/li>\n<li>Create a new database (schema) &mdash; e.g. <code>fivem<\/code> or your server name.<\/li>\n<li>Create a database user with a strong password and grant it full privileges on that database.<\/li>\n<\/ol>\n<h2>Step 2: Install oxmysql<\/h2>\n<p><strong>oxmysql<\/strong> is the standard, async database connector in 2026 &mdash; almost every modern resource depends on it. Place it in <code>resources<\/code> and <code>ensure<\/code> it <strong>before<\/strong> your framework and any script that uses the database.<\/p>\n<h2>Step 3: Add your connection string<\/h2>\n<p>Tell oxmysql how to reach your database with a single line in your <a href=\"https:\/\/xgamingserver.com\/blog\/fivem-server-cfg-explained-every-important-setting\/\">server.cfg<\/a>:<\/p>\n<pre><code>set mysql_connection_string \"mysql:\/\/user:password@localhost:3306\/fivem?charset=utf8mb4\"<\/code><\/pre>\n<p>Replace the user, password, host and database name with yours. If the database is on the same machine, <code>localhost<\/code> is correct; managed hosts usually supply the exact host and port.<\/p>\n<h2>Step 4: Import your framework&#8217;s SQL<\/h2>\n<p>Your framework and many scripts ship <code>.sql<\/code> files that create their tables. Import them into your database through HeidiSQL\/phpMyAdmin (File &rarr; Run SQL file, or paste and execute). Do this for the framework first (ESX\/QBCore\/QBox), then each script that needs tables. Skipping a script&#8217;s SQL is the #1 cause of &#8220;table doesn&#8217;t exist&#8221; console errors.<\/p>\n<h2>Verifying it works<\/h2>\n<p>Start the server and watch the console: oxmysql prints a connection confirmation, and any database errors show the exact table or query at fault. If you see connection refused, double-check the connection string, that MariaDB is running, and that the user has privileges.<\/p>\n<h2>The managed shortcut<\/h2>\n<p>On <a href=\"https:\/\/xgamingserver.com\/five-m-server-hosting\">managed FiveM hosting<\/a>, the database is provisioned for you &mdash; oxmysql and the connection string are wired up, and you import SQL through the panel, skipping the MariaDB install entirely.<\/p>\n<h2>Frequently asked questions<\/h2>\n<h3>Does a FiveM server need a database?<\/h3>\n<p>If you run a framework (ESX, QBCore, QBox) or any persistent script &mdash; yes. The database stores players, money, characters and inventories.<\/p>\n<h3>MySQL or MariaDB for FiveM?<\/h3>\n<p>Either; MariaDB is the common choice for performance and is a drop-in MySQL replacement.<\/p>\n<h3>What is oxmysql?<\/h3>\n<p>The standard async database connector for FiveM. You set your connection string for it in server.cfg and ensure it before your framework.<\/p>\n<h3>Why do I get &#8220;table doesn&#8217;t exist&#8221; errors?<\/h3>\n<p>You haven&#8217;t imported that resource&#8217;s SQL file into your database. Import the framework and each script&#8217;s SQL.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>How to set up a database for FiveM \u2014 MySQL vs MariaDB, oxmysql, the connection string, and importing framework SQL.<\/p>\n","protected":false},"author":2,"featured_media":21557,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_gspb_post_css":"","_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[142],"tags":[],"class_list":["post-21560","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-fivem"],"blocksy_meta":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v24.5 (Yoast SEO v26.7) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>FiveM Database Setup: MySQL\/MariaDB &amp; oxmysql Guide - XGamingServer<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/xgamingserver.com\/blog\/fivem-database-setup\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"FiveM Database Setup: MySQL\/MariaDB &amp; oxmysql Guide\" \/>\n<meta property=\"og:description\" content=\"How to set up a database for FiveM \u2014 MySQL vs MariaDB, oxmysql, the connection string, and importing framework SQL.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/xgamingserver.com\/blog\/fivem-database-setup\/\" \/>\n<meta property=\"og:site_name\" content=\"XGamingServer\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/web.facebook.com\/xgamingserver69\/\" \/>\n<meta property=\"article:published_time\" content=\"2026-06-08T10:28:47+00:00\" \/>\n<meta name=\"author\" content=\"Hectar Carson\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@xgamingserver\" \/>\n<meta name=\"twitter:site\" content=\"@xgamingserver\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Hectar Carson\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/xgamingserver.com\/blog\/fivem-database-setup\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/xgamingserver.com\/blog\/fivem-database-setup\/\"},\"author\":{\"name\":\"Hectar Carson\",\"@id\":\"https:\/\/xgamingserver.com\/blog\/#\/schema\/person\/561042c617869348e75abfe16a269f8d\"},\"headline\":\"FiveM Database Setup: MySQL\/MariaDB &#038; oxmysql Guide\",\"datePublished\":\"2026-06-08T10:28:47+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/xgamingserver.com\/blog\/fivem-database-setup\/\"},\"wordCount\":485,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/xgamingserver.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/xgamingserver.com\/blog\/fivem-database-setup\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/xgamingserver.com\/blog\/wp-content\/uploads\/2026\/06\/gta_15.webp\",\"articleSection\":[\"FiveM\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/xgamingserver.com\/blog\/fivem-database-setup\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/xgamingserver.com\/blog\/fivem-database-setup\/\",\"url\":\"https:\/\/xgamingserver.com\/blog\/fivem-database-setup\/\",\"name\":\"FiveM Database Setup: MySQL\/MariaDB & oxmysql Guide - XGamingServer\",\"isPartOf\":{\"@id\":\"https:\/\/xgamingserver.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/xgamingserver.com\/blog\/fivem-database-setup\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/xgamingserver.com\/blog\/fivem-database-setup\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/xgamingserver.com\/blog\/wp-content\/uploads\/2026\/06\/gta_15.webp\",\"datePublished\":\"2026-06-08T10:28:47+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/xgamingserver.com\/blog\/fivem-database-setup\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/xgamingserver.com\/blog\/fivem-database-setup\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/xgamingserver.com\/blog\/fivem-database-setup\/#primaryimage\",\"url\":\"https:\/\/xgamingserver.com\/blog\/wp-content\/uploads\/2026\/06\/gta_15.webp\",\"contentUrl\":\"https:\/\/xgamingserver.com\/blog\/wp-content\/uploads\/2026\/06\/gta_15.webp\",\"width\":1200,\"height\":675,\"caption\":\"FiveM\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/xgamingserver.com\/blog\/fivem-database-setup\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/xgamingserver.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"FiveM\",\"item\":\"https:\/\/xgamingserver.com\/blog\/category\/fivem\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"FiveM Database Setup: MySQL\/MariaDB &#038; oxmysql Guide\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/xgamingserver.com\/blog\/#website\",\"url\":\"https:\/\/xgamingserver.com\/blog\/\",\"name\":\"XGamingServer\",\"description\":\"Dedicated Game Server Hosting\",\"publisher\":{\"@id\":\"https:\/\/xgamingserver.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/xgamingserver.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/xgamingserver.com\/blog\/#organization\",\"name\":\"XGamingServer\",\"url\":\"https:\/\/xgamingserver.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/xgamingserver.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/xgamingserver.com\/blog\/wp-content\/uploads\/2020\/09\/logo.svg\",\"contentUrl\":\"https:\/\/xgamingserver.com\/blog\/wp-content\/uploads\/2020\/09\/logo.svg\",\"width\":\"1024\",\"height\":\"1024\",\"caption\":\"XGamingServer\"},\"image\":{\"@id\":\"https:\/\/xgamingserver.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/web.facebook.com\/xgamingserver69\/\",\"https:\/\/x.com\/xgamingserver\",\"https:\/\/www.instagram.com\/xgamingserver\/\",\"https:\/\/www.linkedin.com\/company\/xgamingserver\/\",\"https:\/\/www.pinterest.com\/xgamingserver\/\",\"https:\/\/www.youtube.com\/channel\/UCHnOtWxpzaL2r3jM9Jm40EQ\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/xgamingserver.com\/blog\/#\/schema\/person\/561042c617869348e75abfe16a269f8d\",\"name\":\"Hectar Carson\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/xgamingserver.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/1cbcd42dac6c5f21cb52dd64f03fd442250a15f7bb1ade04e23002eb5b384de5?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/1cbcd42dac6c5f21cb52dd64f03fd442250a15f7bb1ade04e23002eb5b384de5?s=96&d=mm&r=g\",\"caption\":\"Hectar Carson\"}}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"FiveM Database Setup: MySQL\/MariaDB & oxmysql Guide - XGamingServer","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/xgamingserver.com\/blog\/fivem-database-setup\/","og_locale":"en_US","og_type":"article","og_title":"FiveM Database Setup: MySQL\/MariaDB & oxmysql Guide","og_description":"How to set up a database for FiveM \u2014 MySQL vs MariaDB, oxmysql, the connection string, and importing framework SQL.","og_url":"https:\/\/xgamingserver.com\/blog\/fivem-database-setup\/","og_site_name":"XGamingServer","article_publisher":"https:\/\/web.facebook.com\/xgamingserver69\/","article_published_time":"2026-06-08T10:28:47+00:00","author":"Hectar Carson","twitter_card":"summary_large_image","twitter_creator":"@xgamingserver","twitter_site":"@xgamingserver","twitter_misc":{"Written by":"Hectar Carson","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/xgamingserver.com\/blog\/fivem-database-setup\/#article","isPartOf":{"@id":"https:\/\/xgamingserver.com\/blog\/fivem-database-setup\/"},"author":{"name":"Hectar Carson","@id":"https:\/\/xgamingserver.com\/blog\/#\/schema\/person\/561042c617869348e75abfe16a269f8d"},"headline":"FiveM Database Setup: MySQL\/MariaDB &#038; oxmysql Guide","datePublished":"2026-06-08T10:28:47+00:00","mainEntityOfPage":{"@id":"https:\/\/xgamingserver.com\/blog\/fivem-database-setup\/"},"wordCount":485,"commentCount":0,"publisher":{"@id":"https:\/\/xgamingserver.com\/blog\/#organization"},"image":{"@id":"https:\/\/xgamingserver.com\/blog\/fivem-database-setup\/#primaryimage"},"thumbnailUrl":"https:\/\/xgamingserver.com\/blog\/wp-content\/uploads\/2026\/06\/gta_15.webp","articleSection":["FiveM"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/xgamingserver.com\/blog\/fivem-database-setup\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/xgamingserver.com\/blog\/fivem-database-setup\/","url":"https:\/\/xgamingserver.com\/blog\/fivem-database-setup\/","name":"FiveM Database Setup: MySQL\/MariaDB & oxmysql Guide - XGamingServer","isPartOf":{"@id":"https:\/\/xgamingserver.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/xgamingserver.com\/blog\/fivem-database-setup\/#primaryimage"},"image":{"@id":"https:\/\/xgamingserver.com\/blog\/fivem-database-setup\/#primaryimage"},"thumbnailUrl":"https:\/\/xgamingserver.com\/blog\/wp-content\/uploads\/2026\/06\/gta_15.webp","datePublished":"2026-06-08T10:28:47+00:00","breadcrumb":{"@id":"https:\/\/xgamingserver.com\/blog\/fivem-database-setup\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/xgamingserver.com\/blog\/fivem-database-setup\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/xgamingserver.com\/blog\/fivem-database-setup\/#primaryimage","url":"https:\/\/xgamingserver.com\/blog\/wp-content\/uploads\/2026\/06\/gta_15.webp","contentUrl":"https:\/\/xgamingserver.com\/blog\/wp-content\/uploads\/2026\/06\/gta_15.webp","width":1200,"height":675,"caption":"FiveM"},{"@type":"BreadcrumbList","@id":"https:\/\/xgamingserver.com\/blog\/fivem-database-setup\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/xgamingserver.com\/blog\/"},{"@type":"ListItem","position":2,"name":"FiveM","item":"https:\/\/xgamingserver.com\/blog\/category\/fivem\/"},{"@type":"ListItem","position":3,"name":"FiveM Database Setup: MySQL\/MariaDB &#038; oxmysql Guide"}]},{"@type":"WebSite","@id":"https:\/\/xgamingserver.com\/blog\/#website","url":"https:\/\/xgamingserver.com\/blog\/","name":"XGamingServer","description":"Dedicated Game Server Hosting","publisher":{"@id":"https:\/\/xgamingserver.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/xgamingserver.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/xgamingserver.com\/blog\/#organization","name":"XGamingServer","url":"https:\/\/xgamingserver.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/xgamingserver.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/xgamingserver.com\/blog\/wp-content\/uploads\/2020\/09\/logo.svg","contentUrl":"https:\/\/xgamingserver.com\/blog\/wp-content\/uploads\/2020\/09\/logo.svg","width":"1024","height":"1024","caption":"XGamingServer"},"image":{"@id":"https:\/\/xgamingserver.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/web.facebook.com\/xgamingserver69\/","https:\/\/x.com\/xgamingserver","https:\/\/www.instagram.com\/xgamingserver\/","https:\/\/www.linkedin.com\/company\/xgamingserver\/","https:\/\/www.pinterest.com\/xgamingserver\/","https:\/\/www.youtube.com\/channel\/UCHnOtWxpzaL2r3jM9Jm40EQ"]},{"@type":"Person","@id":"https:\/\/xgamingserver.com\/blog\/#\/schema\/person\/561042c617869348e75abfe16a269f8d","name":"Hectar Carson","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/xgamingserver.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/1cbcd42dac6c5f21cb52dd64f03fd442250a15f7bb1ade04e23002eb5b384de5?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/1cbcd42dac6c5f21cb52dd64f03fd442250a15f7bb1ade04e23002eb5b384de5?s=96&d=mm&r=g","caption":"Hectar Carson"}}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/xgamingserver.com\/blog\/wp-content\/uploads\/2026\/06\/gta_15.webp","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/xgamingserver.com\/blog\/wp-json\/wp\/v2\/posts\/21560","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/xgamingserver.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/xgamingserver.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/xgamingserver.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/xgamingserver.com\/blog\/wp-json\/wp\/v2\/comments?post=21560"}],"version-history":[{"count":0,"href":"https:\/\/xgamingserver.com\/blog\/wp-json\/wp\/v2\/posts\/21560\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/xgamingserver.com\/blog\/wp-json\/wp\/v2\/media\/21557"}],"wp:attachment":[{"href":"https:\/\/xgamingserver.com\/blog\/wp-json\/wp\/v2\/media?parent=21560"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xgamingserver.com\/blog\/wp-json\/wp\/v2\/categories?post=21560"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xgamingserver.com\/blog\/wp-json\/wp\/v2\/tags?post=21560"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}