Importing Large MySQL Databases (Firstserv Guide)
If your database is too large to upload via phpMyAdmin in cPanel or Plesk, using SSH (Secure Shell) is the most reliable method.
Large imports via phpMyAdmin can fail due to timeouts or connection issues. Importing via SSH avoids these limits and is faster for big databases.
Before You Begin
Make sure you have:
- ✅ Your database backup file (usually .sql)
- ✅ The file uploaded to your server (e.g. in your home directory via FTP or File Manager)
- ✅ An existing database (created via cPanel or Plesk)
- ✅ A database user with full permissions
- ✅ SSH access enabled on your hosting/server
Step 1: Connect via SSH
- Connect to your server using an SSH client:
- Windows: PuTTY or terminal
- macOS/Linux: Terminal
👉 You should now have an active command-line session.
Step 2: Run the Import Command
Use the following command format:
Example
What Each Part Means
- mysql → Starts the MySQL command-line tool
- -u DB_USER → Your database username
- -p → Prompts you to enter your password
- DB_NAME → The database you’re importing into
- < → Redirects the file into MySQL
- dumpfile.sql → Your backup file
Important Notes
- If your file is in another folder, include the full path:
- After running the command:
- Enter your database password
- Press Enter to begin the import
Step 3: Wait for Completion
- Large databases may take time to import
- ✅ It’s normal for the process to take several minutes
⚠️ Do not close the SSH connection until it finishes
Common Issues & Fixes
1. Import Fails or Stops
✅ Solution:
- Delete the database in cPanel/Plesk
- Recreate it
- Run the import again
2. Database Already Exists Errors
Some .sql files contain lines like:
✅ Fix:
- Remove these lines, or
- Comment them out using:
3. Permission Errors
- Ensure your database user has:
- ✅ Full privileges (ALL PRIVILEGES)
cPanel vs Plesk Notes
- ✅ In cPanel:
- Create databases via MySQL Databases
- ✅ In Plesk:
- Create databases via Databases → Add Database
👉 The SSH method works the same in both environments.
Summary
- Use SSH for importing large MySQL databases
- Upload your .sql file to your server
- Run the mysql command with your credentials
- Wait for the import to complete
- Troubleshoot errors by checking database setup and file contents
Need Help?
If you're unsure about SSH access or encounter errors during import, the Firstserv support team is always happy to help guide you through the process.
