Connection refused errors-causes and fixes
Fix "connection refused" errors when connecting to FTP, SSH, or databases. Firewall issues, port blocking, server down, or incorrect credentials.
On this page
"Connection refused" means the server at the address you're trying to reach is active and reachable, but it's actively rejecting your connection attempt. This differs from "connection timeout" (server is down or unreachable) or "host not found" (domain doesn't exist).
Common causes
- Service not running: The FTP server, SSH server, or MySQL isn't running
- Port is blocked: Firewall blocks the port you're trying to connect to
- Port is wrong: Using port 22 for HTTP, or 21 for SSH instead of the correct port
- IP is blocked: Server has blocked your IP address
- Server is down: The service crashed or was disabled
- Wrong credentials: Wrong username or password (sometimes reported as "connection refused" instead of authentication error)
- Local firewall blocks outbound: Your ISP or local network blocks the port
FTP connection refused
Error message: "Connection refused" when connecting with FileZilla, WinSCP, or your FTP client.
Quick fixes in order:
- Verify FTP is enabled in cPanel: Log in to cPanel → Files → FTP Accounts. You should see FTP accounts listed.
- Use correct FTP details:
- Host: ftp.yourdomain.com or your server IP
- Port: 21 (standard FTP) or 990 (SFTP/secure)
- Username: Your FTP account username (not domain name)
- Password: Your FTP account password
- Try passive mode: In your FTP client settings, enable "Passive Mode" (many modern networks require this)
- Use SFTP instead of FTP: If standard FTP fails, try SFTP (port 990) - it's more secure and often less blocked
- Check your local firewall: Temporarily disable your firewall/antivirus to test
- Try from a different network: Connect from mobile hotspot or different WiFi to test if your ISP is blocking
- Verify FTP account isn't suspended: Log in to CustomerPanel → Services → My Services → click your hosting plan → check FTP account status
SSH connection refused
Error message: "Connection refused" when connecting with PuTTY, Terminal, or SSH client.
Important note: SSH is NOT available on shared hosting. If you're on shared hosting and getting "connection refused" on SSH, that's expected—your plan doesn't include SSH access.
For Cloud VPS or Dedicated Servers:
- Verify SSH is enabled: Contact UnderHost support to confirm SSH is enabled on your server
- Use correct SSH details:
- Host: Your server IP address (from your welcome email)
- Port: 22 (standard) or custom port if changed
- Username: root (or your SSH user account)
- Password or SSH key: As provided in your welcome email
- Try SSH key instead of password: If you have an SSH key, use it instead of password authentication
- Check firewall settings: Log in to your VPS control panel (Virtualizor or similar) and verify port 22 isn't blocked
- Verify you're on the correct server: Confirm you have the correct server IP (not another server or old IP)
MySQL connection refused
Error message: "Connection refused" when WordPress or an application tries to connect to MySQL.
Diagnostic steps:
- Check MySQL is running: Log in to cPanel → Home → MySQL Databases. You should see your databases listed.
- Verify database exists: The database name in your wp-config.php must match exactly (case-sensitive)
- Verify username and password: The database user and password in wp-config.php must be correct
- Check MySQL localhost vs IP: Use 'localhost' for connections from the same server (standard)
- Verify database user permissions: In cPanel, the user must have privileges for the specific database
- Check MySQL port: Standard MySQL port is 3306, but some hosts use a different port (check welcome email)
In wp-config.php, verify these lines are correct:
define('DB_NAME', 'your_database_name');
define('DB_USER', 'your_db_user');
define('DB_PASSWORD', 'your_db_password');
define('DB_HOST', 'localhost');
Diagnostic checklist
- ☐ Is the port correct? (FTP=21, SSH=22, MySQL=3306, HTTP=80, HTTPS=443)
- ☐ Is the hostname/IP correct?
- ☐ Is the username correct?
- ☐ Is the password correct?
- ☐ Is the service running on the server? (Check cPanel or server control panel)
- ☐ Are you using the right connection type? (SFTP vs FTP, SSH vs Telnet)
- ☐ Is your local firewall blocking outbound connections?
- ☐ Is your ISP blocking the port?
- ☐ Try from a different network (mobile hotspot, different WiFi)
- ☐ Verify the connection details are correct (IP, hostname, port, username, password)
Firewall and port blocking
Server-side firewall (UnderHost level): If ALL connection attempts fail from different locations, the server's firewall might be blocking the port. Contact UnderHost support to verify port 21 (FTP), 22 (SSH), 3306 (MySQL), etc. are open.
Local firewall (your computer): Windows Defender, macOS firewall, or third-party antivirus might block outbound connections. Temporarily disable and test.
ISP blocking: Some ISPs block port 25 (SMTP) and occasionally other ports. If you're having trouble from home but not on mobile hotspot, your ISP might be blocking that port.
If you've verified all credentials, ports, and local firewall settings, and you're STILL getting "connection refused" from multiple locations, open a support ticket with: your error message, what service you're connecting to (FTP/SSH/MySQL), your IP address, and what you've already tried.
Related: Timeout errors | DNS resolution errors
Still troubleshooting?
Use UnderHost tools for quick checks, or open a support ticket when the issue needs account or server access.





















