Skip to content

Quick Start

Xyranaut edited this page Jun 1, 2026 · 2 revisions

Quick Start (10 minutes)

The absolute fastest path from nothing to "my server talks to MySQL." For the full explanations, follow the linked pages — this is just the happy path to a quick win.

Assumes you already have a working open.mp server. New to that? See open.mp basics first.

1. Get a MySQL in 30 seconds (Docker)

docker run -d --name mysql \
  -e MYSQL_ROOT_PASSWORD=rootpw \
  -e MYSQL_DATABASE=mydb \
  -p 3306:3306 mysql:8.4

No Docker? See Installing MySQL for the graphical installer.

2. Make a database user (over TLS)

docker exec -it mysql mysql -uroot -prootpw -e "
CREATE USER 'omp_app'@'%' IDENTIFIED BY 'change-me-please' REQUIRE SSL;
GRANT SELECT, INSERT, UPDATE, DELETE ON mydb.* TO 'omp_app'@'%';
FLUSH PRIVILEGES;"

3. Install the component

From the latest release:

  • Windows: unzip → omp-mysql.dll into components/, and libssl-3.dll + libcrypto-3.dll next to omp-server.exe.
  • Linux: unzip → omp-mysql.so into components/.
  • Copy omp-mysql.inc into qawno/include/.

4. Tell the server your password (env var, not in code)

export OMP_DB_PASS="change-me-please"      # Linux/macOS
# Windows:  set OMP_DB_PASS=change-me-please

5. Connect from your gamemode

#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);
    g_DB = mysql_connect("127.0.0.1", "omp_app", "${OMP_DB_PASS}", "mydb", cfg);

    if (g_DB == MYSQL_INVALID_HANDLE) { print("MySQL FAILED"); return 1; }

    new cipher[64];
    mysql_get_tls_cipher(cipher, sizeof cipher, g_DB);
    printf("MySQL connected over TLS (%s)", cipher);
    return 1;
}

Start the server. If you see MySQL connected over TLS (TLS_AES_256_GCM_SHA384)you're done. 🎉

6. Want a full login system right now?

Drop in the ready-made mysql-admin demo (it's in the release zip), or build a tiny one yourself with the step-by-step tutorial.


Something not working? → Troubleshooting & FAQ Want to understand what just happened? → How it connects

Clone this wiki locally