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
World desk10 min

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

MySQL error 10061 is a refused TCP connection. Follow this service-to-firewall checklist to verify mysqld, the endpoint, port 3306 or a custom port, TCP settings and remote access.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Error 10061 means the TCP connection to MySQL was refused before authentication began. Check the MySQL server service first, then verify the hostname and configured port (3306 is only the default), force a TCP test with 127.0.0.1, inspect skip_networking and bind_address, and finally review firewall rules. Password changes do not fix a refused socket; they matter only after the server accepts the connection.

What MySQL error 10061 actually means

MySQL labels this condition as error 2003 with the operating-system code 10061: Can't connect to MySQL server on 'server' (10061). Oracle’s MySQL 8.0 Reference Manual describes it as a network connection that has been refused. Your client attempted to open a TCP connection, but no MySQL listener accepted it at that endpoint.

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.

That distinction determines the right fix. A refused connection is a transport problem, not a password problem. The failure usually occurs because mysqld is stopped, the client is using the wrong host or port, TCP networking is disabled, the server listens only on the local loopback address, or a firewall rejects the path.

The sequence below deliberately moves from the server process to the network path and only then to login credentials. Following it in order avoids changing accounts or privileges when the client has not reached MySQL yet.

Use this diagnostic sequence first

  1. Verify that the MySQL server process is running. Use your operating system’s service controls to check the MySQL service. If it is stopped, start it and retry the same client command. If it stops again, treat that as a server-startup problem and inspect the installation’s own error log before changing network settings.
  2. Confirm the exact endpoint. Check the hostname or IP address in the client command, application configuration, connection string, or environment variable. Then verify the TCP port configured by the server. MySQL uses port 3306 by default, according to Oracle/MySQL, but an administrator can change it. A client aimed at 3306 will fail if the server is listening on another port.
  3. Force a local TCP test. For a server on the same computer, specify -h 127.0.0.1 rather than relying on a local socket or name resolution. Include the known port with the client’s --port option when it is not 3306. This test answers a narrow question: can a TCP client reach MySQL on this machine and port?
  4. Test reachability independently. MySQL documents telnet some_host 3306 as a basic TCP reachability test. Substitute the real host and configured port. A successful TCP connection shows that the path is open; it does not prove that a username, password, or database privilege is valid. A refusal points back to the service, endpoint, listener, or firewall.
  5. Inspect the TCP settings. If skip_networking is enabled, MySQL accepts no TCP/IP connections. If bind_address is set to 127.0.0.1, only local loopback clients can connect; remote clients are rejected. Change these settings only when TCP or remote access is intended, then restart or reload according to the installation’s configuration procedure.
  6. Review firewall rules. Check the host firewall and any network firewall for rules covering the MySQL server process and the actual configured TCP port. Opening 3306 does nothing if MySQL uses a different port, and allowing a port does not help if the service is stopped.

Check the MySQL service before changing anything else

A stopped or failed mysqld service is the first condition to eliminate. Open the operating system’s service-management interface and locate the MySQL server entry. Confirm that it is running, not merely installed. If the service is stopped, start it and repeat the original connection attempt.

If the service will not start, do not work around the refusal by opening firewall ports. A firewall cannot create a listener that does not exist. Look at the server’s startup or error-log information supplied by your installation to determine why the process exits. Correct that startup issue, restart the service, and then continue with endpoint testing.

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

When the service reports as running but clients still receive 10061, verify that the running instance is the one you expect. Multiple MySQL installations can use different configuration files and ports. The client may be targeting one instance while the service control panel started another. The configured port, data directory, and server configuration must belong to the same instance.

Verify hostname, IP address and port

3306 is a default, not a promise

Port 3306 is MySQL’s default TCP port in the current Oracle/MySQL reference material. It is not a guarantee that your server uses it. Administrators commonly change the port to fit an existing layout or to run more than one instance. Read the active server configuration or the deployment documentation and copy that value into the client’s --port option.

For example, a local TCP connection can be expressed as:

mysql -h 127.0.0.1 --port=3306 -u username -p

Replace 3306 with the configured value when necessary. Keep the host and port explicit while diagnosing; this prevents a hidden application default from masking the real endpoint.

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

Do not confuse a name problem with a refusal

Confirm that the hostname or IP address in the application is the database server you intend to reach. A typo can send the client to another machine, where the port is closed or no MySQL listener exists. For local testing, 127.0.0.1 removes ambiguity about which machine should answer. For remote testing, use the server’s reachable address and the same port configured on that server.

Use MySQL’s administrative probes

After the service is running, MySQL’s mysqladmin utility can help verify a response and inspect configuration. The manual specifically documents mysqladmin version and mysqladmin variables for checking server response and settings. Point the utility at the same host and port as the failing application. If it cannot establish a connection, continue investigating the listener or network path; if it responds, compare the application’s endpoint and connection options with the working command.

Force TCP instead of a local socket

MySQL clients may use different transports depending on the host value and platform. A local socket or named-pipe connection is not the same test as a TCP connection. To test TCP deliberately, use -h 127.0.0.1 and specify --port when needed.

This distinction explains apparently contradictory results:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Test result What it establishes What it does not establish
Local socket succeeds The local MySQL instance is reachable through that local transport. That TCP is enabled, that a TCP port is open, or that remote clients can connect.
-h 127.0.0.1 over TCP succeeds The local TCP listener accepts connections on the selected port. That a remote host can pass its firewall or reach the same address.
TCP returns 10061 The selected endpoint refused the connection. That the username or password is wrong; authentication has not been reached.
TCP reaches MySQL but returns “Access denied” The network path and MySQL listener responded. That the account has the required privileges.

If a socket works but the forced TCP test fails, inspect skip_networking, the bind address, the configured port, and local firewall policy. Do not infer that the server is healthy for remote use merely because a socket connection works.

Inspect skip_networking and bind_address

When skip_networking is enabled

The skip_networking setting disables MySQL TCP/IP connections. A client that attempts a TCP connection will therefore fail even if a local socket connection works. If applications must connect over TCP, remove or disable this setting in the appropriate MySQL configuration and apply the change using the installation’s documented restart or reload procedure.

Do not disable the setting simply to make a remote test pass. Decide first whether the workload requires TCP. A local application designed to use a socket may not need TCP at all, while a separate application host does.

When bind_address is loopback-only

A server configured with bind_address=127.0.0.1 listens only on the local loopback interface. Local clients can connect through that address, but a remote machine cannot use the server’s LAN or public address to reach MySQL. Set the bind address to an interface appropriate for the intended deployment, then restart or reload as required by the installation.

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

Binding to a broader interface increases the addresses on which MySQL accepts connection attempts; it does not by itself grant database privileges. Remote access still requires a reachable route, a permitted firewall rule, and an account authorized for the connecting host. Expose only the interface and network scope the application needs.

Check firewalls on the actual path

Once the service, host, port and listener settings are correct, examine filtering. On Windows, review Windows Firewall rules for the MySQL process and its configured TCP port. On other systems, inspect the host firewall and any network firewall between the client and server. The exact interface differs by operating system and hosting environment, but the questions are the same:

  • Is the rule written for the port MySQL is actually using?
  • Does it allow traffic from the client’s source network or address?
  • Does it apply to the active network profile or interface?
  • Is another firewall or security appliance blocking the connection upstream?

Use the deliberate TCP test again after each policy change. A successful telnet some_host port reachability test shows that the TCP path is open at that moment; it does not validate MySQL credentials or application-level permissions.

If the client receives an immediate refusal, the destination may have no listener or may be actively rejecting the request. If a connection instead hangs or times out, filtering or routing is more likely. Treat these as different symptoms, but still verify the service, endpoint and configured port before changing rules.

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

Local and remote connections require different checks

Fixing a local connection on the database computer

For a local failure, start with the service state and then force TCP using 127.0.0.1. This avoids an incorrect hostname and distinguishes a socket success from a TCP success. Verify the configured port rather than assuming 3306. If local TCP is refused while the service is running, inspect skip_networking, bind_address, and the local firewall.

A local application may intentionally use a Unix socket or another local transport. In that case, a successful socket connection demonstrates local availability but does not answer whether TCP is enabled for another program. Test the transport the application actually requires.

Fixing a remote connection

For a remote client, validate the server’s reachable address, the configured port, and the route between the two hosts. A loopback bind address prevents remote access even when local tests pass. TCP must be enabled, the server must listen on an address reachable from the client, and each firewall on the path must allow the selected port.

Only after those conditions are satisfied should you investigate account authentication and host-based authorization. A remote account can be correctly configured and still produce 10061 when the network listener is unavailable.

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

Transport refusal versus authentication failure

Message category Stage of the connection Useful next action
Can't connect to MySQL server ... (10061) TCP connection was refused before MySQL authentication. Check service, endpoint, port, TCP settings and firewalls.
An “Access denied” error MySQL answered and rejected authentication or authorization. Check username, password, account host restrictions and privileges.

Changing a password, creating a user, or granting privileges cannot repair a refused TCP socket. Those changes become relevant only after a connection reaches MySQL and the server returns an authentication result.

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

A repeatable command-based workflow

Use the following compact workflow when documenting an incident or handing it to another administrator:

  1. Record the exact error, hostname, port, client command and whether the client is local or remote.
  2. Check the MySQL service in the operating system’s service controls and start it if stopped.
  3. Confirm the server’s configured TCP port; use 3306 only when the configuration confirms it.
  4. Run a local test with -h 127.0.0.1 and the selected --port.
  5. Run mysqladmin version against the same endpoint, then use mysqladmin variables when you need to inspect server settings.
  6. From a remote client, test reachability with the documented form telnet some_host 3306, replacing both placeholders with the real host and port.
  7. Inspect skip_networking and bind_address; apply intentional changes and restart or reload according to the installation procedure.
  8. Review host and network firewall rules for the MySQL process and actual port.
  9. Retry the application. If the message changes to “Access denied,” the transport problem is resolved and authentication troubleshooting is now appropriate.

Common mistakes that prolong error 10061

Opening the wrong port

Allowing 3306 in a firewall while the server listens on a custom port leaves the real path blocked. Always take the port from the active server configuration and carry it through the client command, reachability test and firewall rule.

Changing credentials first

Error 10061 occurs before credentials are evaluated. Password resets and privilege grants cannot make a stopped service listen or make a blocked port reachable.

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.

Assuming a local socket proves TCP works

A socket connection can succeed while TCP is disabled or bound only to loopback. Use -h 127.0.0.1 to test local TCP explicitly, and test the real remote address for remote access.

Binding to every interface without a security plan

Changing bind_address can make MySQL reachable beyond the local machine. Make the change only for a defined application need, limit firewall sources to the required network, and verify the account’s host authorization separately.

Testing a different instance than the application uses

Multiple installations or instances may have distinct configuration files and ports. A successful administrative test is meaningful only when it uses the same host, port and instance that the failing application targets.

When the error persists

Capture the exact endpoint and the result of each layer rather than repeatedly retrying. The useful record includes whether the service is running, the configured port, whether -h 127.0.0.1 works locally, the result of mysqladmin version, the TCP reachability test from the client, and the values of skip_networking and bind_address. This separates a server-startup failure from an endpoint mistake, a disabled listener, and a firewall policy.

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

If all transport checks succeed but the application still reports 10061, compare its connection settings character by character with the working command: hostname, port, protocol selection and any environment-provided overrides. The application may be reading a different configuration file or targeting a different instance than the command-line test.

Official references

Oracle/MySQL explains the meaning of this refusal and the basic troubleshooting sequence in the MySQL 8.0 Reference Manual: Can’t connect to [local] MySQL server. Its broader guidance on connection problems, including endpoint and network checks, is in MySQL 8.0 Reference Manual: Troubleshooting Problems Connecting to MySQL.

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 *

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

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
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.