Table of Contents

Database Management

Starting with version 1.0.96, game servers in GSP-Panel can have databases associated with them. GSP-Panel has the ability to create and delete MySQL databases. Databases get created on the same server that hosts the GSP-Panel frontend, at this time it is not possible to manage remote MySQL installations.

To get started with this feature you will need to make sure your GSP-Panel MySQL user has the permissions below and you will need to configure the game template to allow for database creation and management by going to Configuration > Game Templates > Edit > General > Database Settings.

Permissions Required

In order for GSP-Panel to create databases and users you will need to make sure the GSP-Panel MySQL user has the permissions listed below. Please note in most cases this feature will not work on shared web hosting as a result of needing these permissions.

These permissions can typically be granted with the following SQL query, replace YOURDBUSER with the user that GSP-Panel uses for MySQL access.

GRANT SELECT, SHOW DATABASES, CREATE USER ON *.* TO 'YOURDBUSER'@'localhost' REQUIRE NONE WITH GRANT OPTION;

Technical Bits / How the feature works

When a database creation is requested the following happens:

  1. The requested database name is cleansed, only allowing for a-z, A-Z, 0-9, and a certain unicode range supported by MySQL
  2. The database is then created which is prefixed by gsp_[gameserver ID]_ (e.g. gsp_2290_mydatabase)
  3. After the database is created GSP-Panel checks to see if this gameserver already has a SQL user
    1. If a user already exists then we proceed to step 4
    2. If a user does not exist then one is created using the gspuser_[gameserver ID] structure (e.g. gspuser_2290), in this case a random password is generated
  4. Once the user is added then privileges are then granted to the database

When a database removal is requested the following happens:

  1. Database is deleted
  2. If this is the last database for the game server then the database user is deleted

Limitations