Skip to main content

Gameserver: Import-/Export SQL Files

Many games that support a gameserver frequently use a MySQL database to store files. Some games, resources, or mods may provide you with a .sql file that you can use to import the tables and data contained within into your MySQL database. Exporting a database may also be necessary – whether to transfer specific .sql files between different systems or to independently back up the existing database. In this documentation entry, we will explain step by step how this works in the phpMyAdmin web interface.

Preparation

Before you can begin, you should log into your MySQL database via the phpMyAdmin web interface. If you are not familiar with your MySQL login credentials, you can view them at any time in the GSM under the "SQL" tab.

sql-show

info

In some SQL files, it may occur that specific database names are enforced during the import process. This can lead to conflicts, since at Servertux we assign your database an individual, unchangeable name.

sql_default_value_remove.png

You can easily resolve this issue by opening the SQL file with any text editor and searching for the commands USE 'XXX' or CREATE DATABASE. If you find these commands, please remove them so that the SQL file can be imported without any problems.

Importing an SQL File

Log in to the phpMyAdmin web interface with your credentials, then select your database.
Click on "Import" in the top navigation bar. After doing so, you will be redirected to the import page for the selected database.
Next, click on "Browse". A file explorer window will open, allowing you to select the SQL file you want to upload.

pma_sql_import_de

Before starting the upload, you have the option to adjust specific settings – however, in most cases this is not necessary. Simply scroll down and click on the "Import" button.

The SQL file will be uploaded in just a few moments. Afterward, new tables and entries should be visible in your database.

Exporting an SQL File

Exporting, or backing up, a database is an important option since it allows you to easily transfer or secure a database.

Select your database and click on "Export" in the top navigation bar.
On the export page, you can quickly and easily export your database and save it on your system. By default, the export method is set to "Quick", which exports the entire database. Alternatively, you can click on "Custom" to choose individual settings.

pma_sql_export_de

Once you have selected the export method that suits you, click on the "Export" button.

After completing this step, the database will be downloaded and saved on your system.