Table 'db.x' doesn't exist and Unknown column: import the SQL file
A FiveM script fails with Table doesn't exist or Unknown column? Import its .sql file with HeidiSQL or the mysql CLI, pick the right database, and run the updates.
Your console shows a database error, and the script that caused it stops working:
Table 'fivem.my_table' doesn't exist
Unknown column 'plate' in 'field list'oxmysql shows the same errors as ER_NO_SUCH_TABLE and ER_BAD_FIELD_ERROR. This article covers what they mean and how to fix both: import the script's SQL file into the right database, and run its updates.
What the two errors mean
- Table doesn't exist. The script asks for a table that was never created in the database your server is connected to.
- Unknown column. The table exists, but it has no column with that name. The table came from an older version, or an older SQL file.
In both cases the script is fine. The database does not match what the script expects.
Step 1: find the right database
Before importing anything, check which database the server uses. It is the last part of the connection string in server.cfg:
set mysql_connection_string "mysql://fivem:yourpassword@localhost/fivem?charset=utf8mb4"Here the database is fivem. If you import into another one, for example test or mysql, the script will not see the tables. If the connection itself fails, start with oxmysql can't connect.
Step 2: import the .sql file
Find the file in the script's folder. It is named install.sql, database.sql, or after the script. Open it in a text editor first: if it has a USE some_database; line, make sure it matches your database or remove it.
With HeidiSQL
- Open your session and connect.
- In the left tree, click your database (for example
fivem), so it is the selected one. - Open the File menu and choose Run SQL file, then pick the
.sqlfile. - Refresh the tree with F5, and the new tables appear under the database.
With the mysql command line
mysql -u fivem -p fivem < /path/to/install.sqlThe second fivem is the database name. On Windows PowerShell, < does not work the same way, so run it from cmd, or use HeidiSQL.
With phpMyAdmin
Select the database in the left list, open the Import tab, choose the file and run it.
Warning: back up the database before you import or alter anything. A dump takes seconds:
mysqldump -u fivem -p fivem > backup.sql.
Step 3: apply updates and migrations
When the table exists but a column is missing, an update added it. Scripts handle this in two ways:
- An update file such as
update.sql. Run only the statements newer than the version you installed, since running the old ones again fails withTable ... already exists. - A line in the changelog or the docs with the
ALTER TABLEto run.
An ALTER TABLE that adds a column looks like this:
ALTER TABLE `my_table` ADD COLUMN `plate` VARCHAR(12) NULL;Some scripts create or alter their tables on their own when they start. If yours does, restart the script and watch the console before you do anything by hand.
Tip: if the error only appears for some players, look at which column it names. A column added in an update is often missing only on servers that upgraded the script without running the update.
Case sensitivity on Linux
On Linux, MariaDB and MySQL treat table names as case sensitive by default. A table created as Owned_Vehicles is not found by a query for owned_vehicles, even though it works on a Windows PC.
The fix is to make names match, not to change the server setting:
RENAME TABLE `Owned_Vehicles` TO `owned_vehicles`;Keep table names in lowercase when you create them, and import from a file with the names the script uses.
The framework tables are missing too
If the missing table belongs to the framework, such as users, jobs or owned_vehicles on ESX, or players on QBCore, the base SQL was never imported. That file ships with the framework:
- ESX Legacy: the
.sqlfile insidees_extended(and its optional resources). - QBCore or QBox: the
.sqlfile in the framework download. Some recipes in txAdmin create these tables for you.
A script cannot work until the framework's own tables exist, so import those first.
Clean up the leftovers
After importing, restart the script so it reads the new tables:
restart my_scriptIf the same error comes back, read it again. A different table name or database name in the message means you fixed one problem and reached the next. When a script query is the cause, how to read a script error helps you find the file and line.
Checklist
| Symptom | Fix |
|---|---|
Table 'db.x' doesn't exist |
Import the script's .sql file into the database from mysql_connection_string |
| Imported, but still missing | You selected another database; check the name in server.cfg |
Unknown column |
Run the update or ALTER TABLE for the version you installed |
Table ... already exists on import |
You ran the install file twice; run only the update statements |
| Works on Windows, fails on Linux | Table names are case sensitive; rename to lowercase |
| Framework tables missing | Import the ESX, QBCore or QBox base SQL first |
Quick answers
Where is the .sql file of a script?
Usually in the script's folder, next to fxmanifest.lua, as install.sql, database.sql or a name matching the script. If the script's page or docs mention a table, that file is the one to import.
Do I need to import the SQL file again when I update a script?
Only when the update adds a table or a column. Look for an update.sql or a changelog note, and run only the new statements, since the old ones will fail on tables that already exist.
Why does a table exist on my PC but not on my Linux host?
Linux treats table names as case sensitive. Players and players are two different tables there, while Windows treats them as the same.

