Skip to main content

Database Basics

Databases are organized collections of information that enable applications and servers to persistently store, organize, and quickly access data. In the context of Minecraft servers, they are responsible for storing all key information - from player permissions and statistics to server logs. Choosing the right database determines the performance, stability, and scalability of your server.


Database Types

DatabaseTypeKey FeaturesWhen to Choose?
MariaDBRelational (SQL)A traditional database with tables, secure transactions, support for complex SQL queries, and persistent on-disk data storage. In 90% of cases, it can be used instead of MySQL, and it runs 13-36% faster.When you need structured data, assurance that nothing will be lost, and classic relationships between data. Ideal for Minecraft plugins and migrating from MySQL.
Redis 6 & 7NoSQL, key-value, in-memoryAn extremely fast database running in the computer's memory (responses in fractions of a millisecond, millions of operations per second), great for caching, queues, and saving user sessions. Redis 7: 15-30% better memory management, new Redis Functions, ACLv2 with selectors, improved Sharded Pub/Sub.When you need lightning-fast access to temporary data, accelerating other databases (10-100 times faster reads), or real-time queue systems. Not suitable as a primary database.
MongoDBNoSQL, documentStores data as JSON-like documents, flexible structure without the need for rebuilding, scalability across multiple servers, advanced data processing. Supports secure transactions between documents and automatic failover to backup servers.When data has an irregular structure, you need rapid prototyping, handling large datasets from IoT devices, content management systems, or when the application requires frequent changes to the data structure.

When to Choose Which Database?

  • MariaDB for stability: Minecraft servers, online stores with payments, traditional websites, migrating from MySQL.
  • MongoDB for flexibility: Applications with rapidly changing requirements, product catalogs, content management systems, IoT device applications.
  • Redis as an accelerator: Always as a supplement to the primary database - acceleration (10-100 times faster), user sessions, leaderboards, task queues.

MariaDB

What is MariaDB?

MariaDB is a free, open-source database that is a fork of MySQL. It is fully compatible with MySQL and widely used in web applications and game servers, including Minecraft. MariaDB provides persistent data storage.

What is MariaDB used for in applications?

  • Structured data – information requiring a permanent structure and relationships between tables.
  • Financial transactions – payments, server economy, shops where every single penny counts.
  • Permission systems – group hierarchies, roles, permissions with relationships.
  • Logs and audits – secure storage of action history, data backup.
  • Inventory and items – player items with precise properties and quantities.

MariaDB Configuration

The MariaDB database is fully configured and ready to use immediately upon purchase.

IMPORTANT

Any change to a user password or database permissions requires a full restart of the database server for the new credentials to be properly applied by the system.

Required Connection Data for MariaDB

After launching MariaDB, you will need:

  • Server IP (IP-1 in the panel)
  • Port (by default found after the : colon in IP-1)
  • Database Name (the one you create)
  • Username and Password (the ones you create)

Basic SQL Commands

The table below presents a set of the most frequently used SQL commands along with a description and an example of use, which will help with basic operation of the MariaDB database.

SQL CommandDescriptionExample Use
CREATE DATABASE name;Creates a new databaseCREATE DATABASE luckperms;
USE name;Selects a database for further workUSE luckperms;
CREATE TABLE name (...);Creates a new table with a specified structureCREATE TABLE users (id INT PRIMARY KEY, name VARCHAR(50));
SHOW TABLES;Displays a list of tables in the current database-
DESCRIBE name;Displays the table structureDESCRIBE users;
INSERT INTO name (...) VALUES (...);Adds a new record to the tableINSERT INTO users (id, name) VALUES (1, 'John');
SELECT * FROM name;Retrieves all data from the tableSELECT * FROM users;
SELECT column FROM name WHERE condition;Retrieves data matching a conditionSELECT name FROM users WHERE id = 1;
UPDATE name SET column=value WHERE condition;Updates data in the tableUPDATE users SET name='Anna' WHERE id=1;
DELETE FROM name WHERE condition;Deletes records matching a conditionDELETE FROM users WHERE id=1;
DROP TABLE name;Deletes a table from the databaseDROP TABLE users;
ALTER TABLE name ADD column type;Adds a new column to the tableALTER TABLE users ADD age INT;
GRANT permissions ON db.* TO 'user'@'host';Grants privileges to a userGRANT ALL PRIVILEGES ON luckperms.* TO 'mc_luckperms'@'%';
FLUSH PRIVILEGES;Reloads privileges after changes-

Creating a Database and a User

Creating a database and a user for a plugin

To prepare the MariaDB database to work with other services (e.g., the LuckPerms plugin in Minecraft), execute the following SQL commands:

CREATE DATABASE luckperms;
CREATE USER 'luckperms_user'@'%' IDENTIFIED BY 'YourPassword123!';
GRANT ALL PRIVILEGES ON luckperms.* TO 'luckperms_user'@'%';
FLUSH PRIVILEGES;

Example of Using MariaDB in Minecraft

Configuring LuckPerms with MariaDB

Open the LuckPerms config.yml file and locate the storage section:

plugins/luckperms/config.yml
storage-method: mariadb # or mysql

data:
address: 83.168.94.0:3306 # IP-1 from the panel along with the port
database: luckperms # Name of the created database
username: luckperms_user # Created user
password: 'YourPassword123!' # User password

Additional Settings

If you keep receiving an error similar to:

No operations allowed after connection closed
Failed to validate connection (xxx cannot be called on a closed connection)

You must adjust the maximum-lifetime setting in the LuckPerms configuration and wait_timeout in MariaDB.

It is crucial that the maximum-lifetime value in the LuckPerms configuration is less than the wait_timeout value in the MariaDB configuration.

config.yml file in the LuckPerms plugin:

  • Default maximum-lifetime: 1800000 (30 minutes in milliseconds)

.my.cnf file on the MariaDB server:

  • Default wait_timeout: 600 (10 minutes)

Problem Solution: Reduce maximum-lifetime to a value 30 seconds shorter than the wait_timeout on the MariaDB server.

plugins/luckperms/config.yml
pool-settings:
maximum-lifetime: 1800000 → 570000 # from 30 minutes to 9 and a half minutes

Redis 6 & 7

What is Redis?

Redis is a fast in-memory database (stored in RAM) used on servers as a communication system between servers. It does not permanently store player data - it only relays messages between servers in real time (e.g., permission synchronization, cross-server messages, etc.).

What is Redis used for in applications?

  • Cache and acceleration – caching database query results (10-100x faster reads).
  • Real-time communication – chats, notifications, cross-server synchronization (PubSub).
  • User sessions – storing login data and sessions in RAM.
  • Leaderboards and rankings – score tables in games, contests, live statistics.
  • Task queues – background task processing, notification systems.

Redis Configuration

Setting a Password

  1. In the Startup Parameters tab, locate the Redis Password field.
  2. Set a strong password (e.g., YourPassword123!).
  3. Save changes and restart the Redis server.
IMPORTANT

After changing the password in the Redis Password field, a full restart of the Redis service is required for the new authentication key to be loaded.

Required Connection Data for Redis

After launching Redis, you will need:

  • Server IP (IP-1 in the panel)
  • Port (by default found after the : colon in IP-1)
  • Password (the one you set in the parameters)

Example of Using Redis in Minecraft

Open the LuckPerms config.yml file and locate the messaging section

Apply the following configuration on at least two Minecraft servers with the LuckPerms plugin installed:

plugins/luckperms/config.yml
messaging-service: auto → redis

redis:
enabled: false → true
address: 83.168.94.0:6379 # IP-1 from the Console tab.
username: ''
password: '0fiT0DCeripKV*s7!' # Password set in Redis Startup Parameters.

Testing the Connection

After restarting the servers, perform a test:

  1. On one server: /lp user [player_name] meta addprefix 100 "&aTEST"
  2. Check on the second server if the prefix appears instantly.
  3. In the logs of the second server, you should see: [luckperms]: [Messaging] Received user update ping

MongoDB

What is MongoDB?

MongoDB is a free, open-source, document-oriented NoSQL database that stores data in BSON (Binary JSON) format - an extended version of JSON. Unlike traditional relational databases (like MariaDB/MySQL), MongoDB does not use tables and rows, but rather collections and documents.

What is MongoDB used for in applications?

  • Storing player data with a flexible structure (statistics, inventory, settings).
  • Authentication systems – irregular data structures.
  • Configurations – different plugins, different data formats.
  • Cache and sessions – fast access to user data.
  • API data storage – native fit for JSON/REST APIs.

MongoDB Configuration

Setting the Administrator Password

  1. In the Startup Parameters tab, find the Mongo Admin Password field.
  2. Set a strong password (e.g., YourPassword123!).
  3. Save changes and start the MongoDB server.

Changing the Password in the MongoDB Console

After launching the server, you must open the Console tab and set the same password for the admin user as you did in Startup Parameters:

use admin
db.changeUserPassword("admin", "YourPassword123!")
IMPORTANT

Setting a new administrator password in the Startup Parameters and Console will become fully active for external connections only after conducting a full restart of the MongoDB database.

Required Connection Data for MongoDB

After configuring MongoDB, you will need:

  • Server IP (IP-1 in the panel)
  • Port (by default found after the : colon in IP-1)
  • Username (admin or one created by you)
  • Password (the one you set in the parameters)
  • Authentication Database (usually admin or the created one)

Creating a Database and a User in MongoDB

Basic Commands

  1. Switch to/create a database:
use [database_name] # e.g., use luckperms
  1. Create a user with permissions:
db.createUser({user:"username",pwd:"YourPassword123!",roles:[{role:"readWrite",db:"database_name"},{role:"dbAdmin",db:"database_name"}]}) # e.g., db.createUser({user:"luckperms_user",pwd:"YourPassword123!",roles:[{role:"readWrite",db:"luckperms"},{role:"dbAdmin",db:"luckperms"}]})
  1. Insert the first document so the database is actually created:
db.init.insertOne({created: new Date()})

Basic Most Frequently Used MongoDB Commands

The table below presents a set of the most important MongoDB commands along with a description and an example of use:

MongoDB CommandDescriptionExample Use
show dbsDisplays a list of all databases-
use db_nameSwitches to the specified database (creates it if it doesn't exist)use luckperms
dbDisplays the current database-
show collectionsDisplays collections in the current database-
db.collection.insertOne({...})Inserts one document into the collectiondb.users.insertOne({name:"Jan", age:25})
db.collection.insertMany([{...}])Inserts multiple documents into the collectiondb.users.insertMany([{name:"Anna"},{name:"Piotr"}])
db.collection.find()Retrieves all documents from the collectiondb.users.find()
db.collection.find({...})Retrieves documents matching a conditiondb.users.find({age: 25})
db.collection.findOne({...})Retrieves the first document matching a conditiondb.users.findOne({name: "Jan"})
db.collection.updateOne({...}, {$set:{...}})Updates a single documentdb.users.updateOne({name:"Jan"}, {$set:{age:26}})
db.collection.updateMany({...}, {$set:{...}})Updates multiple documentsdb.users.updateMany({age:25}, {$set:{status:"active"}})
db.collection.deleteOne({...})Deletes a single documentdb.users.deleteOne({name:"Jan"})
db.collection.deleteMany({...})Deletes multiple documentsdb.users.deleteMany({age:{$lt:18}})
db.collection.drop()Deletes the entire collectiondb.users.drop()
db.dropDatabase()Deletes the entire database-

Example of Using MongoDB in Minecraft

Configuring LuckPerms with MongoDB

Open the LuckPerms config.yml file and configure the storage section:

plugins/luckperms/config.yml
storage-method: MongoDB

data:
address: 83.168.94.0:27017 # IP-1 from the panel along with the port
database: luckperms # Name of the created database
username: luckperms_user # Created user
password: 'YourPassword123!' # User password

mongodb-collection-prefix: 'lp_' # Prefix for collections
mongodb-connection-uri: '' # Leave empty
Method 2: Using a Connection URI (Alternative)
plugins/luckperms/config.yml
storage-method: MongoDB

data:
mongodb-connection-uri: 'mongodb://luckperms_user:YourPassword123!@83.168.94.0:27017/luckperms'

Connection String for Other Applications

mongodb://username:YourPassword123!@83.168.94.0:27017/database_name