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
-
Make sure SSH is enabled
-
Connect to your hosting via SSH
-
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.sqlFor 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.sqlAfter 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.