Restore or import large MySQL database backups reliably using secure command-line tools.
If you need to restore or import a large MySQL database backup, using SSH can be a more reliable option than browser-based tools such as phpMyAdmin. This guide shows you how to prepare your database, upload your SQL backup, connect through How to Enable SSH Access (if available to you), import the database, and check that your website is working afterwards.

Before You Begin
Before importing your database via SSH, make sure you have:
- Access to your 1-grid Client Portal
- An active hosting account with SSH access enabled
- An existing MySQL database and a database user with the required permissions
- Your SQL or compressed database backup file (
.sqlor.sql.gz) and its upload location
💡 Important: If the target database already contains data, importing a backup may create, replace, or modify existing data. Always back up your current data before proceeding.
Follow These Steps
1. Open Your Hosting Service
Log in to your 1-grid Customer Zone and open the hosting service associated with your website. Confirm that SSH access is available. If SSH isn’t available, you may need to use an alternative tool like How to Access phpMyAdmin.
2. Check Your Database
Confirm that your target database and database user exist with the correct permissions before running any command lines.
3. Upload Your SQL Backup
Upload your database backup file (.sql or .sql.gz) to your hosting account using File Manager, FTP, or SFTP. Take note of the file path (e.g., /home/username/backups/website.sql).
4. Connect Using SSH
Use an SSH client (like PuTTY on Windows, or Terminal on macOS and Linux) to connect to your hosting account using your SSH credentials.
5. Import Your SQL Database
For a standard .sql backup file, run the following command in your terminal:
bash
mysql -u database_username -p database_name < backup.sql
Use code with caution.
(Replace database_username, database_name, and backup.sql with your actual database details and file path. Enter your database password when prompted. Never put your password directly into the command string).
6. Import a Compressed SQL Backup
If your backup is a compressed .sql.gz file, run:
bash
gunzip < backup.sql.gz | mysql -u database_username -p database_name
Use code with caution.
7. Wait for the Import to Complete
Allow large databases several minutes to finish importing completely before closing your SSH session.
8. Check Your Database and Website
Verify that your database tables and data are present, your website loads correctly, and user logins function as expected.
What Happens Next?
Importing a database restores database content only, not your underlying website files. If your site still errors after an import, verify your connection strings or check that your database user permissions match.
You’re Ready!
You have successfully imported your MySQL database backup using SSH. Keep your original backup file safe until you are fully satisfied with your site’s performance.
Related Articles
- How to Create a MySQL Database (cPanel)
- How to Set Up a Database in Windows Plesk
- How to Create a Database User (cPanel)
- Database Guides
Need Help?
If you run into error codes or cannot complete your database import, contact us. Our Support team is ready to assist.
Have your domain name, database name, and the SSH command used (excluding your password) ready for a faster investigation.