Backing Up and Restoring MySQL/MariaDB Databases Using SSH

For Linux Web Hosting packages

In this article, we'll show you how to back up and restore your database using the mysqldump tool.

Prerequisites

You need a web hosting package with shell access.

Creating a Backup of a Database

mysqldump --no-tablespaces --host=dbxxxxx.hosting-data.io --user=dboXXXXXXX --password=geheimes_Passwort dbXXXXXXX > dbXXXXXXXX.sql 

You can find the connection data for your database right in your IONOS account.

Please Note: If your file names, passwords, or user names contain special characters, write these in single quotation characters, such as password='password'.

A SQL dump will now be created. It is a text file containing all the data and instructions required to restore the database in SQL format.

Restoring Databases from a Backup

To restore a database from a .sql file, run the mysql command in the shell as follows:

mysql --host=dbxxxxx.hosting-data.io --user=dboXXXXXXX --password=geheimes_Passwort dbXXXXXXX < dbXXXXXXXX.sql 

If the SQL dump is compressed in the gzip format, use the following command:

gunzip -c dbXXXXXXX.sql.gz | mysql --host=dbxxxxx.hosting-data.io --user=dboXXXXXXX --password=geheimes_Passwort dbXXXXXXX 

Did this article help you?

Your feedback helps us to further improve our services. To leave feedback, log in to your IONOS account by clicking on the login button at the top right. You can then submit a rating below the article.