![]() |
||||||||||||||||||||||||||||||||||||||||||||||||||||
|
[Plugin] MySQL for open.mp - Printable Version +- open.mp forum (https://forum.open.mp) +-- Forum: SA-MP (https://forum.open.mp/forumdisplay.php?fid=3) +--- Forum: Releases (https://forum.open.mp/forumdisplay.php?fid=13) +---- Forum: Plugins (https://forum.open.mp/forumdisplay.php?fid=32) +---- Thread: [Plugin] MySQL for open.mp (/showthread.php?tid=4274) |
||||||||||||||||||||||||||||||||||||||||||||||||||||
MySQL for open.mp - Xyranaut - 2026-06-01 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 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
Migrating from SA-MP-MySQL Same concepts (connect → query → callback → read rows); modern/standard names. Most-used mappings:
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. |