Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix Now×
Skip to content
VGSources
Blog

How to Fix “Can’t Connect to MySQL Server” Error 10061

MySQL error 10061 means the TCP connection was refused. Follow this service, endpoint, TCP, configuration, and firewall checklist to restore local or remote access.
Length9 min Posted Quest giverVGSources Team
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Error 10061 is a refused TCP connection, not a bad-password message. Your client reached the requested network endpoint, but no MySQL server accepted the connection. Check the mysqld service first, then verify the host and port, force a TCP test, inspect MySQL’s network settings, and finally check firewalls. MySQL documents this condition as ERROR 2003, “Can’t connect to MySQL server on ‘server’ (10061),” which indicates that the network connection was refused (MySQL 8.0 Reference Manual).

The sequence below works for a local development database, a game server database on another machine, and command-line diagnostics. It also explains when a Unix socket, skip_networking, bind_address, or an authentication rule is the real issue.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What error 10061 actually tells you

10061 is reported at the transport stage. The MySQL client attempted a TCP connection to a host and port, but the operating system refused it. At that point, MySQL has not yet evaluated the username, password, database privileges, or SQL statement.

The refusal normally has one of these causes:

  • The mysqld server process is stopped, crashed, or failed to start.
  • The client is using the wrong hostname, IP address, or TCP port.
  • MySQL TCP networking is disabled with skip_networking.
  • MySQL is listening only on loopback, commonly through bind_address=127.0.0.1, while the client is remote.
  • A host or network firewall blocks the MySQL process or its configured port.

MySQL’s connection troubleshooting guidance starts by checking the server process and then the connection endpoint (Troubleshooting Problems Connecting to MySQL). Treat the number as a routing and service-state clue, not as evidence that credentials are wrong.

Fastest diagnostic path

Run these checks in order. Stop when one identifies the fault, correct it, and retry the same connection.

Check What to do What the result means
Server process Verify that the MySQL service is running on the machine that should accept the connection. If it is stopped or failed, no client can connect until it starts successfully.
Endpoint Confirm the exact hostname or IP and the configured TCP port. Use the client’s --port option when the port is not the default. A wrong endpoint sends the client to a machine or listener that is not MySQL.
Forced TCP For a local test, connect with -h 127.0.0.1. For a reachability test, try telnet some_host 3306 with the real host and port. This separates TCP problems from local socket or name-resolution behavior.
MySQL network settings Inspect skip_networking and bind_address. Disabled TCP or loopback-only listening explains many remote refusals.
Firewall Review rules on the database host and any network firewall for the actual MySQL process and port. A rule for 3306 does not help if MySQL is configured for another port.

1. Verify that mysqld is running

Start with the database host, not the client computer. A local client and a remote client can both receive 10061 when the server process is down.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

On Windows

  1. Open the Windows Services console by running services.msc.
  2. Find the installed MySQL service. The displayed name varies by installation and version.
  3. Check its status. If it is stopped, choose Start. If it starts and immediately stops, inspect the MySQL error log before attempting network changes.
  4. Retry the original client command after the service remains running.

On Linux or another Unix-like host

  1. Use the operating system’s service manager to inspect the MySQL service status. Installations may register the unit as mysql, mysqld, or another distribution-specific name.
  2. Start the service through that manager if it is inactive.
  3. If startup fails, correct the startup error first; a firewall rule cannot make a failed server accept connections.
  4. Retry from the same client and endpoint used before.

Do not assume that a MySQL configuration file exists in the location used by another installation. The service’s own startup configuration and error log are the authoritative places to determine which instance is running and which configuration it loaded.

2. Confirm the host and TCP port

The client must target the address where MySQL is listening. Check the hostname or IP in the connection string, launcher configuration, environment variable, or application settings. A typo, an old private IP, or a hostname resolving to a different machine can all produce a refusal.

MySQL uses TCP port 3306 by default, according to the current MySQL Reference Manual, but administrators can change it. Treat 3306 as a default rather than a guarantee. Find the configured port in the server configuration or the administrator’s deployment documentation, then pass that value explicitly:

mysql --host=127.0.0.1 --port=3306 -u your_user -p

Replace both the host and port with the real endpoint. For a remote server, an example is:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

mysql --host=db.example.internal --port=3307 -u your_user -p

The command examples show syntax, not credentials. Never paste a production password into a command that will be stored in shell history or shared logs.

3. Force a deliberate TCP test

“localhost” can select a local Unix socket or another platform-specific local transport instead of TCP. To test the network path itself, use the numeric loopback address:

mysql -h 127.0.0.1 -P 3306 -u your_user -p

If this works while a command using localhost fails, the server may be reachable but the local socket or name-resolution choice is wrong. Keep using the transport your application is configured to require, and correct that configuration rather than treating the password as the cause.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Probe the port without authenticating

MySQL’s troubleshooting manual documents Telnet as a basic reachability test:

telnet some_host 3306

Substitute the actual database host and configured port. A successful TCP opening shows that something accepted the socket; it does not prove that MySQL authentication will succeed. If the connection cannot be opened, continue with the service, listening-address, port, and firewall checks.

Ask MySQL utilities for a response

When the endpoint is expected to be reachable, these utilities can help identify whether a server is responding and expose configuration values:

  • mysqladmin --host=127.0.0.1 --port=3306 version requests the server version response.
  • mysqladmin --host=127.0.0.1 --port=3306 variables displays server variables that can help confirm the active configuration.

Use the same host and port that the failing application uses. Testing a different endpoint can create a false success.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

4. Inspect MySQL’s TCP settings

Check for skip_networking

If skip_networking is enabled, MySQL accepts no TCP/IP connections. Local clients may still work through a Unix socket, which can make the server appear healthy while every TCP client receives 10061.

Use the installation’s configuration inspection procedure or mysqladmin variables from a working local connection to determine whether TCP networking is disabled. Remove or disable skip_networking only when TCP access is required, then restart or reload MySQL according to that installation’s procedure. Retest with -h 127.0.0.1 before testing from another machine.

Check bind_address

A setting such as bind_address=127.0.0.1 makes MySQL listen only on the server’s loopback interface. Local connections can succeed, while a game server, admin tool, or other client on another machine is refused because MySQL is not listening on the server’s network interface.

If remote access is intentional, configure a listening address that includes the required interface or addresses, following your organization’s network policy. Do not broaden listening exposure merely to make an error disappear. After changing the setting, restart or reload MySQL as required by the installation and verify the resulting value with mysqladmin variables.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

5. Check firewalls on the complete path

Inspect the database host’s operating-system firewall, any cloud or hypervisor firewall, and network firewalls between the client and server. Rules may be written for either the MySQL executable or a TCP port. Check both against the port MySQL is actually configured to use.

  • On Windows, review inbound rules in Windows Firewall for the MySQL service or its configured TCP port.
  • On Unix-like systems, review the host firewall and any service that manages packet filtering.
  • For hosted or segmented networks, verify that the network policy allows the client’s source address to reach the database host and port.

Prefer a narrowly scoped rule for the known application or client network. Opening a database port to every address is not a safe substitute for identifying the correct source and destination. If a firewall change is made, rerun the same TCP probe and MySQL command so that only one variable changes at a time.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Local connection versus remote connection

Situation Transport to verify Most relevant checks
Client and MySQL on one machine Unix socket or TCP loopback Service state, -h 127.0.0.1, local port, and skip_networking.
Client on another machine TCP over the network Server’s listening address, configured port, route, and every firewall in the path.
Local socket command succeeds but TCP fails Socket works; TCP path does not Check skip_networking, port selection, and the loopback listener.
Local TCP works but remote TCP fails MySQL accepts loopback only or the network path is blocked Check bind_address, host and network firewalls, and the remote endpoint.

This distinction prevents a common misdiagnosis: a successful local socket login does not prove that a remote TCP client can reach MySQL.

Do not treat 10061 as an authentication error

An authentication failure is reported after the server accepts the network connection. Messages such as “Access denied” indicate that MySQL was reached and then rejected the account, password, host authorization, or privileges. Error 10061 occurs earlier, when the TCP socket is refused.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Message category Stage Correct next step
Can’t connect … (10061) Transport connection refused Check service, endpoint, listener, TCP settings, and firewall.
Access denied for user Server reached; authentication or authorization failed Check account name, password, allowed host, and privileges.

Changing a password, granting a database privilege, or editing an account host pattern will not make a refused TCP socket start accepting connections. Resolve the transport problem first, then address any authentication message that appears afterward.

Recovery branches for common symptoms

“It worked yesterday, and now localhost returns 10061”

  1. Check whether the MySQL service is still running after a reboot, update, crash, or configuration change.
  2. Confirm that the application still targets the same port.
  3. Force TCP with -h 127.0.0.1 and the configured port.
  4. If only socket connections work, inspect skip_networking and the active MySQL configuration.

“Local tools connect, but a remote game server cannot”

  1. Confirm the remote client is using the database host’s reachable IP or DNS name, not localhost or 127.0.0.1. Those addresses refer to the remote client itself.
  2. Verify that MySQL is not bound only to 127.0.0.1.
  3. Confirm the configured port and allow that port from the remote client’s network through host and network firewalls.
  4. Use telnet some_host port from the remote machine, then retry the MySQL client with the same endpoint.

“The port probe reaches something, but the MySQL client fails”

  1. Confirm that the probe used the same hostname and port as the client.
  2. Check whether another service, rather than MySQL, is listening on that port.
  3. Retry with mysqladmin version and inspect the returned error. If the server is reached and the error changes to authentication or authorization, move to account troubleshooting.

“Changing the firewall rule had no effect”

  1. Verify the rule’s port matches MySQL’s configured port, not simply the 3306 default.
  2. Check for a second firewall on the host, router, cloud network, or segmented subnet.
  3. Confirm that MySQL is actually listening on the expected interface; a firewall cannot fix a listener bound only to loopback.

Verify the repair without guessing

  1. Record the exact host and port used by the application.
  2. Confirm the MySQL service remains running after any restart.
  3. Run a TCP test with -h 127.0.0.1 for local connections or the real server address for remote connections.
  4. Use mysqladmin version or a normal MySQL client login to verify that the server responds.
  5. Only after transport succeeds, resolve any new “Access denied” or privilege message.

A successful repair is reproducible: the same endpoint accepts a TCP connection from the same client, and the application uses that endpoint rather than an undocumented default. Keep the configured port and listening-address decision in the deployment documentation so a restart or migration does not silently send clients back to 3306 or loopback.

Command reference

Purpose Command pattern Use it when
Force local TCP mysql -h 127.0.0.1 -P 3306 -u your_user -p You need to avoid a socket or ambiguous localhost behavior.
Test raw reachability telnet some_host 3306 You want to test whether the host and port accept a TCP opening.
Request a server response mysqladmin --host=some_host --port=3306 version You need to distinguish a responding MySQL endpoint from a refused connection.
Inspect variables mysqladmin --host=some_host --port=3306 variables You need to verify active network-related settings from a working connection.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More quests from Patch Notes

  1. How to Set Up a RedM (RDR2) Server in 2026: License Key, txAdmin and server.cfg, Step by StepBlog11min
  2. Best RedM (RDR2) Server Hosting in 2026: Comparing Four Hosts on Slots, Memory and PriceBlog10min
  3. How to Host a Mindustry Server in 2026: server-release.jar, Port 6567 and the Commands That MatterBlog7min
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.