What is MariaDB?
MariaDB is an open-source database system, very similar to MySQL, used to store and manage data. ThoriumLXC uses it as its database of choice.
What is: Database
Think of it as a digital filing cabinet that organizes and keeps track of all the information your application needs. In the context of an emulator server, MariaDB stores essential game data like character information, items, and the state of the game world.
That way, when the server want to know something about a character, it knows exactly where to look.
How MariaDB Fits into the Architecture
Within an emulator server environment, MariaDB acts as the brain that stores all of the game’s important information. Each time a player logs in, picks up an item, or interacts with the game world, the emulator server communicates with MariaDB to update or retrieve that information, ensuring that everything remains consistent and accurate.
When using containers, the MariaDB container runs the database server, and any of its databases can be written to a volume. A volume is essentially a filesystem—similar to the one on your own machine—but packaged in the same manner as a container image.
services:
database:
image: mariadb:10.5
volumes:
- mariadb_data:/var/lib/mysql
ports:
- "3306:3306"
volumes:
mariadb_data:
driver: local
Connection Details in emulator server
The connection between the emulator server and MariaDB is defined in the configuration files realmd.conf
and mangosd.conf
. These files specify where the emulator server should find the database and how to connect, including:
- Database server address: Specifies where the database resides (e.g., a specific server IP address).
- User credentials: The username and password required for the emulator server to access the database.
- Database names: Each database holds different types of information, such as character data or game world data.
Docker Compose simplifies this process because, rather than needing to know the server address or credentials, we can simply use the name assigned to the MariaDB container (e.g., database
).
What is phpMyAdmin?
phpMyAdmin acts like Google Sheets or Excel for your database. It provides a user-friendly web interface that lets you easily view and edit the data stored in MariaDB. Think of it as a window into your database, where you can see all the tables and rows of data.
For example, you can open phpMyAdmin to view a list of characters in the game, edit their levels, or delete items from their inventories.
Hold Up!
If you need to perform a simple task—such as increasing a level or adding an item—it is recommended to use the dot commands (e.g., .account
, .additem
) rather than modifying the database directly, as these operations often involve more than simply altering a single column in the database.