Skip to content

Installation

imshooter edited this page Oct 24, 2026 · 1 revision

The files

A release holds:

File Where it goes
mysql.dll The components folder of the server.
mysql.inc The include folder of the compiler, as qawno/include.
LICENSE.txt and the other licenses Anywhere, they are the licenses of the component and of the libraries inside it.

MariaDB Connector/C, yyjson, Argon2 and crypt_blowfish are linked into mysql.dll, so no other file and no plugin is needed. The server is 32 bit, and so is the component. Only a Windows build is available for now.

The include

#include <open.mp>
#include <mysql>

mysql.inc needs nothing but the natives of open.mp. It can sit beside the R41 plugin, as their names do not meet, so a gamemode can move one query at a time. See Coming from R41.

The first start

The server log lists mysql and its version among the components it loaded. A connection is made by a script, with MySQL_Connect or MySQL_ConnectFile. A connection that fails is logged with its reason, and the handle is still given, so the queries sent later connect when the database is back:

new MySQL:gDatabase;

public OnGameModeInit() {
    new
        error[128]
    ;

    gDatabase = MySQL_ConnectFile("mysql.ini");

    if (gDatabase == INVALID_MYSQL_ID) {
        print("mysql.ini is not valid.");
    } else if (!MySQL_IsConnected(gDatabase)) {
        MySQL_GetConnectionError(gDatabase, error);
        printf("The database is not reachable yet: %s", error);
    }

    return 1;
}

Building

Windows with Visual Studio 2022 or its Build Tools, and CMake 3.19 or later. CMake fetches the open.mp SDK, the Pawn headers and MariaDB Connector/C 3.4.11.

cmake -S . -B build -A Win32
cmake --build build --config Release --target mysql

The component is written to build/Release/mysql.dll.

Clone this wiki locally