-
Notifications
You must be signed in to change notification settings - Fork 0
Quick Start
Xyranaut edited this page Jun 1, 2026
·
2 revisions
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.
docker run -d --name mysql \
-e MYSQL_ROOT_PASSWORD=rootpw \
-e MYSQL_DATABASE=mydb \
-p 3306:3306 mysql:8.4No Docker? See Installing MySQL for the graphical installer.
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;"From the latest release:
-
Windows: unzip →
omp-mysql.dllintocomponents/, andlibssl-3.dll+libcrypto-3.dllnext toomp-server.exe. -
Linux: unzip →
omp-mysql.sointocomponents/. - Copy
omp-mysql.incintoqawno/include/.
export OMP_DB_PASS="change-me-please" # Linux/macOS
# Windows: set OMP_DB_PASS=change-me-please#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. 🎉
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
Understand
Use
- Installing MySQL
- Docker Compose
- Getting started
- Configuration
- SQL crash course
- Designing your tables
- Storing game data
- Dates & times
- First queries
- Async patterns
- Reading results
- Prepared statements
- Passwords & hashing
- Transactions
- Models (active-record)
- Tutorial: login system
- mysql-admin demo
Deeper
Reference