What "couldn't open connection to server" means
"Couldn't open connection to server" and "could not connect to server" mean your computer never completed a TCP connection to the address and port it tried. The program has not reached the login stage, so your password is not the problem. One of three things is wrong: nothing is listening on that port, a firewall is in the way, or the host name or port is wrong.
The wording varies by program, but the underlying error is usually one of three:
| Underlying error | Code | What it means | Look at first |
|---|---|---|---|
| Connection refused | 111 on Linux (ECONNREFUSED), 10061 on Windows (WSAECONNREFUSED) | The server was reached, but nothing accepted the connection on that port | Is the service running, and on that port and address? |
| Connection timed out | 110 on Linux (ETIMEDOUT), 10060 on Windows (WSAETIMEDOUT) | No reply at all: packets were dropped on the way | Firewalls, the wrong IP, or the server being down |
| Host not found | Varies by program | The name did not resolve to an IP address | DNS and spelling of the host name |
Microsoft's Winsock reference explains that a refusal "usually results from trying to connect to a service that is inactive on the foreign host". PostgreSQL's documentation makes the same point: "Connection refused" does not mean the server received your request and turned it down. In a web browser these errors appear as ERR_CONNECTION_REFUSED and ERR_CONNECTION_TIMED_OUT. A connection that opens and is then cut off is a different problem, covered in connection reset.
The error message for each app, in one table
| Program | Typical message | Default port | Usual cause |
|---|---|---|---|
| Telnet on Windows | Could not open connection to the host, on port 23: Connect failed | 23, or the port you type | Nothing listening, or a firewall |
| Telnet on Linux | telnet: Unable to connect to remote host: Connection refused | 23, or the port you type | Nothing listening on that port |
| FileZilla (FTP) | Error: Could not connect to server, often after Connection timed out after 20 seconds of inactivity | 21 (FTP), 22 (SFTP) | Wrong protocol or port, or a firewall |
| MySQL and MariaDB | ERROR 2003 (HY000): Can't connect to MySQL server on '...' (111) | 3306 | Server only listening on 127.0.0.1, or the port is closed |
| PostgreSQL | could not connect to server: Connection refused (older) or connection to server at "..." failed (newer) | 5432 | listen_addresses or the firewall |
| Minecraft Java | Failed to connect to the server with a "Connection refused" or "timed out" line | TCP 25565 | Server stopped, wrong port, or firewall |
| Minecraft Bedrock | A connection error (wording varies by device) | UDP 19132 | UDP port not open |
| TallyPrime | Unable to access the configured Tally Gateway Server | Set in TallyPrime | Gateway Server not running on the network |
| SSH | ssh: connect to host ... port 22: Connection refused | 22 | See our SSH connection refused guide |
Step 1: test the port from your own computer
First find out whether the port answers at all. This tells you whether to look at the network or the application.
Windows (PowerShell):
Test-NetConnection db.example.in -Port 3306
Look at the last line. TcpTestSucceeded : True means the port is open and the problem is in the application, such as the username, password or database settings. False means the connection itself fails. Add -InformationLevel Quiet to get a plain True or False.
Linux and macOS:
nc -zv -w 5 db.example.in 3306
In the OpenBSD netcat that Ubuntu ships, -z only checks whether something is listening, -v prints the result and -w 5 gives up after 5 seconds. "succeeded" means the port is open. "Connection refused" comes back at once. A wait followed by a timeout means packets are being dropped.
If the host name may be stale, compare nslookup db.example.in with the server's real IP; a stale answer is fixed by clearing the DNS cache.
Step 2: check that the service is listening on the server
On the server, check whether the program is listening, and on which address.
Linux:
sudo ss -tlnp
sudo ss -ulnp # UDP, for Minecraft Bedrock
Here -t shows TCP sockets, -u UDP, -l only listening ones, -n numeric ports and -p the process. The Local Address column matters most. 127.0.0.1:3306 accepts connections only from the server itself. 0.0.0.0:3306 or *:3306 accepts them on every interface. If the port is missing, start the service, for example with sudo systemctl status mysql and then start.
Windows Server:
netstat -ano | findstr :3306
Here -a includes listening ports, -n keeps them numeric and -o adds the process ID. A LISTENING line means the program is up.
Step 3: open the firewall, and only to who needs it
If the service is listening but Step 1 still fails, a firewall is blocking it, either on the server or in your provider's network.
# Ubuntu and Debian (ufw)
sudo ufw allow 25565/tcp
sudo ufw allow proto tcp from 203.0.113.5 to any port 3306
# AlmaLinux and Rocky (firewalld)
sudo firewall-cmd --permanent --add-port=25565/tcp
sudo firewall-cmd --reload
# Windows Server (PowerShell as administrator)
New-NetFirewallRule -DisplayName "MySQL from office" -Direction Inbound -Protocol TCP -LocalPort 3306 -RemoteAddress 203.0.113.5 -Action Allow
Ubuntu's ufw manual notes that deny drops traffic silently while reject tells the sender, which is why one blocked port times out and another is refused. Game ports can be open to everyone; open database and admin ports only to fixed addresses, as in the second and last lines.
Telnet: "Could not open connection to the host"
Most people see this while using Telnet to test a port, not to log in. Microsoft's documentation for the message lists two causes: the server is listening on a different port, or the service is not running at all.
- Give the port.
telnet example.intries port 23. To test a mail or web port, type it after the host:telnet example.in 587. - "'telnet' is not recognized as an internal or external command": the client is not installed. Microsoft's telnet reference notes that the client must be installed before the command works. Install it from an elevated prompt with
dism /online /Enable-Feature /FeatureName:TelnetClient, or useTest-NetConnectionfrom Step 1, which needs no install. - Port 25: "Could not open connection to the host, on port 25" from a server or a home connection usually means outbound port 25 is blocked by the network you are on. That is normal on most hosts and ISPs. Read why port 25 is closed and send mail on 587 instead; the ports are listed in email port numbers.
FTP: "Could not connect to server" in FileZilla
FileZilla writes the attempt in its message log, and the last line is Error: Could not connect to server. The lines above it give the reason:
- ECONNREFUSED: nothing accepts connections on that port. The usual cause is a protocol and port mismatch: SFTP sent to port 21, or FTP sent to port 22. Set the protocol explicitly in Site Manager instead of typing a bare host name.
- Connection timed out after 20 seconds of inactivity, before login: a firewall is dropping the control connection, or the host name points at the wrong server.
- Login works, then the directory listing times out: FTP uses a second connection for data. FileZilla's network configuration guide recommends passive mode. If the client is already passive, the server's passive port range is closed in its firewall.
Our guide to FTP vs SFTP vs FTPS covers the ports and the cPanel settings, and cPanel port numbers lists the rest.
MySQL: "Can't connect to MySQL server" (error 2003 and 2002)
MySQL's manual separates two errors. Error 2002 means the client could not reach a local server through its Unix socket: mysqld is not running, or the client is looking for the socket file in the wrong place. Error 2003 means a network connection was refused. The number in brackets is the operating system's code: (111) on Linux, (10061) on Windows.
For error 2003, the manual lists these server settings:
skip_networkingturned on: the server accepts no TCP/IP connections at all.bind_address = 127.0.0.1: the server listens only on the loopback interface, so remote clients are refused.port: the client must use the same port, 3306 by default.- A firewall blocking 3306.
# on the server
sudo ss -tlnp | grep 3306
mysqladmin -h 127.0.0.1 --port=3306 version
Do not open 3306 to the whole internet just to make the error go away. Allow only the addresses that need it, or keep MySQL on 127.0.0.1 and connect through an SSH tunnel. If WordPress shows "Error establishing a database connection", follow that guide, which also covers wrong credentials.
PostgreSQL reports the same failure as could not connect to server: Connection refused in older versions and connection to server at "..." failed: Connection refused in current ones, followed by "Is the server running on that host and accepting TCP/IP connections?". The documented common cause is listen_addresses not allowing remote TCP connections. Change it, allow the client in pg_hba.conf, and restart PostgreSQL.
Minecraft: can't connect to the server
Java Edition shows "Failed to connect to the server" with a longer line underneath. "Connection refused" means you reached the machine but the game server is not listening on that port. "Connection timed out" means the packets never got an answer.
- Port and protocol: the Minecraft Wiki lists Java Edition's
server-portas TCP 25565 by default. Bedrock Dedicated Server uses UDP, with 19132 as the default IPv4 port. Opening the TCP port does nothing for Bedrock players. - Address: if the server runs on another port, players must type it as
ip:port. Leaveserver-ipinserver.propertiesempty, as the wiki recommends, so the server listens on every interface. - Is it running? Check the server console or
sudo ss -tlnp | grep 25565. - Firewall: open the port in ufw and in your provider's firewall. A server on a home PC also needs port forwarding on the router, which some connections behind carrier-grade NAT cannot do.
nc -zv -w 5 your-ip 25565 tests a Java server from another machine. UDP has no handshake, so test a Bedrock server by joining from a phone on mobile data. The full setup is in how to make a Minecraft server, and sizing is in Minecraft server RAM.
Tally: could not connect to the server or Tally Gateway
TallyPrime has several connection paths, and each fails with its own message:
- "Unable to access the configured Tally Gateway Server": TallyHelp says this appears when the Tally Gateway Server is not running on the network, or cannot connect to TallyPrime. Its fix is to reactivate the licence, or choose Use License from Network on the Start-up or Manage License screen.
- "Activation/reactivation failed due to Gateway Server installation failure": for this separate error, TallyHelp says to make sure TallyPrime and TallyPrime Server have their inbound and outbound rules enabled in Windows Defender Firewall.
- Integrations, Excel or ODBC cannot connect: TallyPrime listens for these on a port you configure, 9000 by default. If another program already uses that port, TallyHelp says to set a different one. TallyHelp shows it under Help > About (its ODBC page opens Help with Alt+F1), in the Client/Server and ODBC Services section.
- Data synchronisation fails: the server and port are set under Alt+Z (Exchange) > Configure > Client/Server Configuration, and the connection log is under F1 (Help) > Troubleshooting > Event Log.
- Remote users cannot reach a shared data folder: never expose Windows file sharing or Remote Desktop to the internet. Our guides on Tally multi user setup and Tally remote access cover the safer options.
Connection problems on a Bigdomainhost server
Every Bigdomainhost KVM VPS in Mumbai or Delhi NCR comes with full root access and a dedicated IPv4 address, so you control which services listen and which ports are open. Game servers and Tally on Cloud are set up on request: enquire about an application server or about Tally on Cloud. If a connection still fails, WhatsApp us at +91 75994 50220 at any time with the error and the port test output, or call in IST working hours.
This guide was written by the Bigdomainhost team with AI assistance; messages, commands and options were checked against the linked sources on 25 November 2026.
Sources (checked )
- Microsoft Learn: Error message: could not open a connection to host on port 23 (archived)
- Microsoft Learn: telnet command reference
- Microsoft Learn: Installing Telnet Client via command line (archived blog)
- Microsoft Learn: Test-NetConnection cmdlet
- Microsoft Learn: Windows Sockets error codes
- Microsoft Learn: netstat command reference
- Microsoft Learn: New-NetFirewallRule cmdlet
- Linux kernel: asm-generic/errno.h (ECONNREFUSED 111, ETIMEDOUT 110)
- Ubuntu Manpages: nc_openbsd(1)
- man7.org: ss(8) manual page
- Ubuntu Manpages: ufw(8)
- FileZilla: Network Configuration wiki (archived)
- MySQL 8.4 Reference Manual: Can't connect to [local] MySQL server
- PostgreSQL Documentation: Starting the database server: client connection problems
- PostgreSQL Documentation: Version 13: client connection problems (older message format)
- PostgreSQL Documentation: The pg_hba.conf file
- firewalld: firewall-cmd manual
- Minecraft Wiki: server.properties
- Minecraft Wiki: Bedrock Dedicated Server
- TallyHelp: Gateway Server errors and resolutions
- TallyHelp: Data source name not found (ODBC port)
- TallyHelp: Set up for data synchronisation