Database
A database is, simply put, a place where data is stored, read and edited (typically by a plugin).
Database types
From the standard user’s point of view, simply put, databases are of two types.
- File-based database
This is a database that is stored as a single file on disk. This kind of database is e.g. H2 (used by e.g. LuckPerms by Default) and SQLite (used by CoreProtect by default).
- Standalone database
A standalone database (such as MySQL) is a database that runs as a separate service (process). This database can be remotely connected to from another server. This kind of database is probably what the user normally thinks of as a “database”.
Standalone database
Usecase
A standalone database is most commonly used in the case of proxy servers where data needs to be synchronized across multiple individual servers. Another reason may be to access data remotely (e.g. when you want to view data on the web).
There are many possible usecases, these are the most common ones.
Database setup
In case the plugin does not use a standalone database as a storage type automatically, you need to set the storage type to this database in the plugin configuration where you want to use the database.
This option is often called storage-method
, storage-type
or similar.
If the plugin contains data that you don’t want to lose after changing the storage type, you need to perform a data conversion. Read more here.
After changing the storage type, you need to set the data to the database itself. By default, the following fields needs to be configured:
- database address (sometimes also referred to as ‘host’)
- database name
- database user name
- password
- port (in case it is not the default, which is e.g. 3306 for MySQL)
The steps mentioned above need to be done on all servers that will use the database as storage (so e.g. in case of using LuckPerms, when you want to have permissions connected on all servers, you need to set the data to the same database on all servers including the proxy server).
Below is shown an example of what the LuckPerms configuration might look like to use MySQL as a storage.
storage-method: "MySQL"
data:
address: "mysql.myhost.com"
database: "user_luckperms_53642"
username: "root"
password: 'XT7D28Cp2xDp;'
Leave all other settings as default and only modify them if you know what you are doing. This is because you almost always only need to edit the settings mentioned above, i.e. the storage type, database address (or port if it is not the default), database name, user, and password.
Data loss after changing storage type
When the storage type is changed in the plugin (e.g. from SQLite to MySQL), the existing data seems to disappear.
However, no data disappears. The data still exists, but because of the storage change, the plugin no longer works with it. If you changed the storage type back to the original one, the data would reappear (logically, see here).
Therefore, if you still want the original data after changing the storage type, you must perform a data conversion. How to do the data conversion depends on the plugin, so you can read more in its documentation.
Other
MySQL size
When a database is provided as an additional service, it often has a smaller maximum size per database (typically 1 GB). In this case, it is not suitable for plugins like Dynmap, which takes up much more space. However, for plugins like LuckPerms, this size is usually absolutely sufficient.
What is MariaDB
It is possible that your service provider provides MariaDB instead of MySQL, which is “better” MySQL. You don’t have to worry about this, as MariaDB is compatible with MySQL. As a regular user, you have almost no chance to tell the difference between these databases.
Database licenses
If you are using shared hosting and request MongoDB, it may happen that your request is rejected by the provider, even though the individual requests are normally met. This happens because of the license, the problematic part of which is below. The same applies to the Redis Stack (RediSearch, RedisJSON, …) and, as of version 7.4, Redis itself (https://www.theregister.com/2024/03/22/redis_changes_license/).
However, plugins on new versions require MongoDB rarely. You will mostly encounter the requirement for MongoDB or Redis on paid plugins for old “pvp versions” (1.7.10/1.8.8).
“The SSPL is based on the GNU Affero General Public License (AGPL), with a modified Section 13 that requires that those making SSPL-licensed software available to third-parties (modified or not) as part of a “service” must release the source code for the entirety of the service, including without limitation all “management software, user interfaces, application program interfaces, automation software, monitoring software, backup software, storage software and hosting software, all such that a user could run an instance of the service using the Service Source Code you make available”, under the SSPL. The chapter structure of the Server Side Public License is identical to that to the AGPL, except that the GPL preamble and application instructions are stripped from the license text.“ Source: https://en.wikipedia.org/wiki/Server_Side_Public_License