Import a large MySQL database via SSH (mysql) on shared hosting
- 20.02.2026 00:58
-
- database
- hosting
- mysql
- ssh
If you need to import a large MySQL database dump, phpMyAdmin uploads can fail due to browser and PHP limits. On GARMTECH hosting, the most reliable method is importing via SSH using the mysql command.
Before you start
- Make sure SSH access is enabled for your hosting subscription in Plesk.
- Create the database and database user in Plesk (or confirm they already exist).
- Upload the dump file (
.sqlor.sql.gz) to your hosting space.
Step 1 – Upload the dump file to hosting
You can upload the file using:
- Plesk File Manager (recommended for quick uploads), or
- FTP‑SSL (FTPS) to your service server hostname.
For very large files, uploading a compressed dump (.sql.gz) is usually faster.
Step 2 – Connect to your hosting via SSH
Use the server hostname from My.GARMTECH and your hosting system user (shown in Plesk under Hosting Settings).
ssh USERNAME@SERVER_HOSTNAME
If you are unsure what hostname to use, open your service details in My.GARMTECH and look for Server Hostname.
Step 3 – Import the database
Go to the folder where you uploaded the dump, for example:
cd httpdocs
Import a .sql file
mysql -u DBUSER -p DBNAME < backup.sql
Import a .sql.gz file
gunzip < backup.sql.gz | mysql -u DBUSER -p DBNAME
When prompted, enter the database user password.
Step 4 – Verify the import
- Open phpMyAdmin from Plesk and confirm tables/data exist, or
- Run a quick check in SSH:
mysql -u DBUSER -p -e "SHOW TABLES;" DBNAME
Common errors and fixes
“Access denied for user”
- Verify the database username and password.
- Make sure the user has permissions for this database in Plesk.
“Unknown database”
- Check the database name in Plesk.
- Create the database first, then import.
“No such file or directory”
- Confirm you are in the correct folder.
- Use
ls -lahto list files and confirm the dump filename.
After the import
- Remove the dump file from hosting if you no longer need it (large backups can consume disk space).
- Update your website configuration (
wp-config.php, CMS settings, etc.) if database name/user/password changed.
Related Articles
Comments
Add Comment