How to export a database over SSH in Hostinger

Export a database over SSH in Hostinger: gather your database details, connect via SSH, and run mysqldump to create an .sql backup file.

Updated 3 days ago

Export a database over SSH in Hostinger when the database is too large for phpMyAdmin, or when a phpMyAdmin export fails. Gather your database details, connect to your hosting plan via SSH, and run the mysqldump command to create an .sql backup file.

Step 1 – Preparation

Gather your database details: database name, user and password. If you don’t remember the database password, you can change it.

Step 2 – Connect to SSH

  1. Make sure SSH is enabled

  2. Connect to your hosting via SSH

  3. Open your root directory (public_html)

Step 3 – Export the database

Use the following command to export the database:

mysqldump -u database_username -p database_name > file.sql

For example, if the parameters of your database are:

  • Database name: u123456789_database

  • Username: u123456789_admin

  • Exported database backup name: backup.sql

The command will look like this:

mysqldump -u u123456789_admin -p u123456789_database > backup.sql

After that, you will be prompted to enter the database password, and the exporting process will start. Keep in mind that the time it will take may vary depending on the size of your database.

Your database is now exported to the .sql backup file in your website’s root directory. To export a database without the command line, you can also export a database with phpMyAdmin.