omp-MySQL
A modern, secure MySQL database component for open.mp — clean-room, with an industry-standard API.
Repo: github.com/Mac-Andreas/omp-MySQL
Download (v1.0.0): Releases
Docs / wiki: Wiki
What is it?
A native open.mp component (drops into components/, not a legacy plugin) that lets your Pawn gamemode talk to MySQL — safely. It's inspired by the classic SA-MP-MySQL but rebuilt from scratch for modern MySQL and the open.mp Component SDK.
Why another MySQL plugin?
SA-MP-MySQL (BlueG / maddinat0r) was excellent — for its time. That time was the MySQL 5.x / SA-MP era, and it's been discontinued since ~2019. Modern MySQL changed a lot (default caching_sha2_password auth, mandatory-friendly TLS, utf8mb4), open.mp moved to a modern Component SDK, and security expectations rose. omp-MySQL is a clean-room project built for today's MySQL and open.mp: TLS is on by default, passwords are hashed for you, and player input is injection-safe by construction.
omp-MySQL vs SA-MP-MySQL (BlueG)
Highlights
Tested
Quick example
Install
Migrating from SA-MP-MySQL
Same concepts (connect → query → callback → read rows); modern/standard names. Most-used mappings:
Two convention changes: prepared-statement params are 1-based, and result values use the mysql_rs_* family. Full guide: Migration.
Docs
The wiki is a full book — from "what is a database?" (with diagrams) through installing MySQL, SQL basics, prepared statements, async patterns, the mysql-admin demo, building from source, and security. There's a one-page cheat sheet too.
Notes
Feedback, bug reports, and PRs welcome — issues.
omp-MySQL is an independent community project — not affiliated with or endorsed by open.mp or Oracle. "MySQL" is a trademark of Oracle; "open.mp" and "SA-MP" of their respective authors; used here only to describe compatibility.
A modern, secure MySQL database component for open.mp — clean-room, with an industry-standard API.
Repo: github.com/Mac-Andreas/omp-MySQL
Download (v1.0.0): Releases
Docs / wiki: Wiki
What is it?
A native open.mp component (drops into components/, not a legacy plugin) that lets your Pawn gamemode talk to MySQL — safely. It's inspired by the classic SA-MP-MySQL but rebuilt from scratch for modern MySQL and the open.mp Component SDK.
Why another MySQL plugin?
SA-MP-MySQL (BlueG / maddinat0r) was excellent — for its time. That time was the MySQL 5.x / SA-MP era, and it's been discontinued since ~2019. Modern MySQL changed a lot (default caching_sha2_password auth, mandatory-friendly TLS, utf8mb4), open.mp moved to a modern Component SDK, and security expectations rose. omp-MySQL is a clean-room project built for today's MySQL and open.mp: TLS is on by default, passwords are hashed for you, and player input is injection-safe by construction.
omp-MySQL vs SA-MP-MySQL (BlueG)
| SA-MP-MySQL (BlueG) | omp-MySQL | |
| Plugs into | SA-MP plugin ABI | native open.mp Component SDK |
| MySQL era | 5.x / MariaDB | modern 8.x / 9.x (also runs on 5.7) |
| Encryption | optional, often off | mandatory TLS, fail-closed (1.3/1.2) |
| Password hashing | none built in | Argon2id (mysql_hash / mysql_verify) |
| Injection safety | escape helpers | prepared statements + %e + multi-stmt off |
| API naming | SA-MP-MySQL specific | industry-standard (JDBC/DB-API style) |
| Secrets | usually in source | ${ENV} expansion + optional obfuscation |
| Extras | cache, ORM | cache, models, VECTOR search, compression |
| Status | discontinued (~2019) | active, v1.0.0 |
Highlights
- Mandatory TLS, fail-closed — TLS 1.3 (MySQL 8.0+) / TLS 1.2 (5.7); refuses to connect unencrypted. No plaintext path.
- Prepared statements — bound parameters, injection-safe (plus %e escaping; multi-statements off by default).
- Argon2id password hashing built in.
- Fully async — one worker thread per connection; the main tick never blocks.
- Self-contained — MariaDB Connector/C statically linked, OpenSSL bundled. No separate client install.
- Result cache, active-record models, MySQL 9 VECTOR similarity search, ${ENV} secrets, opt-in rate/length guards.
Tested
- Live MySQL: 5.7.44, 8.0.46, 8.4.9 LTS, 9.2.0 — TLS + queries + prepared statements + caching_sha2 all pass. VECTOR verified on 9.x (it's 9.0+ only).
- Memory: clean under AddressSanitizer + UBSan; static leak/UAF/thread audit.
- Pentested: SQL injection (login box, registration, command args), auth bypass (rejoin / slot reuse), persistent-login enforcement, privilege bootstrap. Details in the wiki's Security page.
Quick example
Code:
#include <open.mp>
#include <omp-mysql>
new MySQL:g_DB;
public OnGameModeInit()
{
new MySQLConfig:cfg = mysql_config_create();
mysql_config_set(cfg, SSL_MODE, SSL_MODE_REQUIRED); // TLS on
g_DB = mysql_connect("127.0.0.1", "user", "${OMP_DB_PASS}", "mydb", cfg);
if (g_DB == MYSQL_INVALID_HANDLE) print("MySQL connection failed.");
return 1;
}Install
- Windows: unzip the windows package — omp-mysql.dll into components/, and the bundled libssl-3.dll / libcrypto-3.dll next to omp-server.exe.
- Linux: omp-mysql.so into components/.
- Put omp-mysql.inc in qawno/include/ and #include <omp-mysql>.
Migrating from SA-MP-MySQL
Same concepts (connect → query → callback → read rows); modern/standard names. Most-used mappings:
| SA-MP-MySQL | omp-MySQL |
| mysql_tquery | mysql_execute |
| mysql_pquery | mysql_execute_for |
| mysql_query | mysql_execute_sync |
| cache_get_value_name_int | mysql_rs_get_int_by |
| cache_num_rows | mysql_rs_row_count |
| cache_insert_id | mysql_rs_insert_id |
| mysql_get_ssl_cipher | mysql_get_tls_cipher |
| (none) | mysql_prepare / mysql_stmt_set_* |
| (none) | mysql_hash / mysql_verify |
| orm_* | mysql_model_* |
Docs
The wiki is a full book — from "what is a database?" (with diagrams) through installing MySQL, SQL basics, prepared statements, async patterns, the mysql-admin demo, building from source, and security. There's a one-page cheat sheet too.
Notes
- Minimum MySQL 5.7 (first with default TLS). Recommended 8.4 LTS.
- 32-bit (i386) — the open.mp server arch.
- MIT licensed (links the LGPL-2.1 MariaDB Connector/C). No code reused from SA-MP-MySQL.
Feedback, bug reports, and PRs welcome — issues.
omp-MySQL is an independent community project — not affiliated with or endorsed by open.mp or Oracle. "MySQL" is a trademark of Oracle; "open.mp" and "SA-MP" of their respective authors; used here only to describe compatibility.
Xyranaut
Founder & Developer
Mac Andreas
Open Source Projects:
Looking for Beta Testers for my open.mp Mac project! [Apply here]
Founder & Developer
Mac Andreas
Open Source Projects:
- Using a MacBook with Apple Silicon? Play open.mp natively on macOS. [Get it here]
- Need a Pawn IDE that runs natively on macOS? Qawno brings the classic experience to Mac. [Get it here]
- Coding in VS Code? Open Pawn provides modern Pawn tooling across Windows, macOS and Linux. [Get it here]
- Upgrade your MySQL with omp-MySQL — secure (TLS, Argon2id, prepared statements), MySQL 5.7–9.2, full wiki & migration guide. MIT, built for open.mp. [Get it here]
Looking for Beta Testers for my open.mp Mac project! [Apply here]
- Must have MacBook Air M1 (Base: 8C CPU, 7C GPU, 8GB Ram) or above with Wine32 or Crossover
- Experience in plugin development, scripting and debugging, using crossover and navigating Wine32
- European Region preferred - for low latency testing (UK best)
- Experience in using AI applications and analytics to understand behaviour patterns collected by telementary data.


