-
Notifications
You must be signed in to change notification settings - Fork 0
What is MySQL
This page assumes you know nothing about databases. We'll go slow.
Imagine your game server needs to remember things about players: their money, their score, their admin level. Where do you put that so it's still there tomorrow?
You could write it in a text file. But text files get messy fast — what if two players save at the same time? What if you have 10,000 players? How do you quickly find "the player named Bob"?
A database solves this. Think of it as a magic notebook that:
- keeps your data in neat tables (like a spreadsheet),
- can find any row instantly (even among millions),
- handles many writers at once without scrambling the data,
- survives a server restart.
MySQL is one of the most popular database programs in the world. It's the "notebook" your server writes to and reads from.
A table is a grid. Here's an accounts table:
+----+----------+-------+-------+
| id | name | money | level | <- columns (what we store)
+----+----------+-------+-------+
| 1 | Alice | 5000 | 0 | <- a row (one player)
| 2 | Bob | 250 | 4 | <- another row
+----+----------+-------+-------+
- Columns describe what you store (name, money, level).
- Rows are the actual entries (one row per player).
- id is a unique number for each row, so there's never confusion between two players, even if they pick the same name.
You don't click buttons to use a database — you send it short text commands in a language called SQL (Structured Query Language). Examples:
-- give me Bob's money
SELECT money FROM accounts WHERE name = 'Bob';
-- create a new player
INSERT INTO accounts (name, money, level) VALUES ('Carol', 0, 0);
-- Bob earned 100
UPDATE accounts SET money = money + 100 WHERE name = 'Bob';That's basically it: SELECT (read), INSERT (add), UPDATE (change),
DELETE (remove). Everything else builds on those four.
Your open.mp server is written in Pawn. Pawn can't speak SQL to MySQL on its
own — it needs a translator. omp-MySQL is that translator: you call simple
Pawn functions like mysql_execute(...), and it sends the real SQL to MySQL over a
secure connection, then hands you back the answer.
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