oxmysql
Installation
SKILL.md
oxmysql
Server-side MySQL/MariaDB access for FiveM through the MySQL table (replacement for mysql-async and ghmattimysql).
Activation Contract
Load this skill when the user writes or edits database code in a FiveM resource: SELECT/INSERT/UPDATE/DELETE, upserts, transactions, MySQL.*, exports.oxmysql, or migrating from mysql-async.
Hard Rules
- Server only. Add
server_script '@oxmysql/lib/MySQL.lua'tofxmanifest.luaabove other server scripts. MySQL.Sync.*andMySQL.Async.*(mysql-async compatibility layer) are NOT available. Replace them withMySQL.query,MySQL.scalar,MySQL.single,MySQL.insert,MySQL.update,MySQL.prepare,MySQL.transaction, each with a.awaitvariant.@namedplaceholders are deprecated: use positional?with an array of values.prepareaccepts only?(and??for column names).- Never concatenate user input into SQL; every value goes through a placeholder.
- Every function takes
(query, params, callback); use.awaitto yield instead of nesting callbacks. - Use
transactionwhen several writes must succeed or fail together; it rolls back on any failure. - Use
rawExecuteonly when the normalized result shape ofquery/prepareis insufficient. - Prefer MariaDB over MySQL 8 for compatibility.