Zum Inhalt springen

Working with MySQL databases

TYPO3 and most other CMS use a MySQL database. Here is all the information about working with MySQL in our hosting plans.

General information

The following parameters are required to access the database:

  • the database user
  • the database name
  • the database server (host)
  • the server port (default: 3306)
  • the password for the database

In our Classic Hosting, the database name and the database user are identical and have the format db123456_789. With our Cloud Hosting, the customer can determine the database name and the database user themselves, apart from a prefix specified by us.

The size of the database is not limited by the size of the hosting package. However, care should be taken to ensure that the databases are not too large, as otherwise the performance of the website will suffer and a backup/restore can take a very long time. In addition, a backup on the web space can cause it to fill up and impair the function of the website.

As our database servers (MySQL, MariaDB) run on the same server as the web server (Apache), no data has to be transferred via the server network, which results in faster delivery of the database content.

Database server

The following database servers are available for our cloud hosting:

  • db.mariadb1011 (MariaDB 10.11)
  • db.mariadb103 (MariaDB 10.3)
  • db.mysql56 (MySQl 5.6)

The following database servers are available for our Classical Hosting:

  • mariadb106 (MariaDB 10.6)
  • localhost (MariaDB 10.4)
  • mysql (MySQl 5.7)

Export and import of databases

In principle, you can also export/import databases via PhpMyAdmin, but especially with larger databases you will quickly reach the limits (PHP script runtime or memory limit).

Log in to the shell with your SSH user. On Windows you can use the free Putty program for this, on MacOS/Linux you can do this directly in the shell. You can find your SSH access data in your customer menu [Configuration ' SSH access (shell)].

Export database to file

The safest way to export a database is directly on the shell with the command mysqldump.

An export of the database is created with the following command:

mysqldump --opt --no-tablespaces -u db159422_875 -p -h mariadb106 db159422_875 > db159422_875.sql

The -h parameter specifies the database server.

In this command, replace db159422_875 with the name of your database. After pressing the Enter key, the password for the database is requested. All this data can be found in your customer menu, the password for the database can also be found in the configuration of your website.

Import database from file

The safest way to import a database is directly on the shell using the mysql command.

A database is imported using the command:

mysql -u db12345_678 -p -h mariadb106 db12345_678 < filename.sql

The -h parameter specifies the database server.

In this example, the file "filename.sql", which was previously created with mysqldump, is used as the "input source".

In this command, replace db12345_678 with the name of your database. After pressing the Enter key, the password for the database is requested. All this data can be found in your customer menu, the password for the database can also be found in the configuration of your website.

External access to databases

IMPORTANT: For security reasons, access from external systems to the databases is only possible via an SSH tunnel.

In the following examples, we use a domain name as the host name. If you have problems establishing a connection, use the IP address of the server.

You can view the IP address in your customer menu [SSH access (shell) ' Gears ' Open].

Establish SSH tunnel with PuTTY

To set up an SSH tunnel, please follow the steps below:

1. set up a normal SSH connection (with PuTTY)(supplementary video instructions)

1.1. go to the "Session" category.
Enter a domain name from your domain administration or the server IP address as the host name and select "SSH" as the protocol. The correct port (22) is set automatically.

1.2 Now to the "SSH" category.
"2" should be selected here as the "Preferred SSH Protocol Version".

2. set up the SSH tunnel
Now go to "Tunnels" under Category. Enter the number "3306" under "Source Port" and the database server (see above) including the port under "Destination". Confirm the whole thing by clicking on "Add". Check two boxes under "Port forwarding".

3. save settings
Now go back to the "Session" category and enter a name for your session under the text "Saved Sessions". By clicking on Save, you have saved the settings for the next connection and can restore them by selecting the previously created name and clicking on "Load".

4. open the connection
The last thing you need to do is click on "Open" at the bottom of the window and confirm any messages about new certificates that may appear.

Direct access to a database with "MySQL Workbench"

It is also possible to access the databases directly with external programs via SSH tunnel. Possible programs are, for example, "MySQL Workbench" (Windows, MacOS, Linux) or "Sequel Pro" (MacOS).

For the following example, we use the Windows version of "MySQL Workbench".

1. create a new MySQL connection by clicking on the plus button on the start screen.

2. enter any name under "Connection Name".

For "Connection Method", select "Standard TCP/IP over SSH".

You can use the domain name as the "SSH host name", alternatively use the IP address of the server.

You can find the "SSH Username" in your customer menu in the "SSH Access (Shell)" area. If you no longer know the password, you will need to assign a new one there.

Click on "Store in Vault" under "SSH Password" and then enter the SSH password.

Enter the database server (see above) for "MySQL Hostname". The "MySQL Server Port" is 3306.

For the username, enter the database user name that you can find in your customer menu.

Enter the password for the database by clicking on "Store in Vault".
If you no longer know the database password, you may be able to find it in the LocalConfiguration.php of the TYPO3 installation (or a configuration file of another system if you are not working with TYPO3).
If you do not know the database password, you would have to assign a new one in your customer menu and then adjust it in the configuration file.

To check whether the connection can be established, you can click on "Test Connection". If everything is OK, then click on "OK".

3. the established connection is now available in the start screen of "MySQL Workbench" and can be started by double-clicking on it.

4. you can then work directly with the database.

For information on the use and operation of "MySQL Workbench", please refer to the program documentation.

This page contains automatically translated content.

Updated: 17.07.2024