Software⏱️ 3 min read📅 2026-06-03

How to Fix error 111 Error – Can't connect to MySQL server error 111

MySQL server connection issue due to socket issue.

Quick Answer: Check the MySQL socket file location, as it might be different from localhost. Try setting the socket option when connecting to the MySQL server.

The 'Can't connect to MySQL server error 111' issue affects users who are trying to establish a connection with a MySQL server running on a Linux box. This error occurs when the MySQL server is not listening on the specified IP address, causing the client to fail.

This error can be frustrating for developers and administrators who rely on MySQL servers for their applications. The good news is that this issue can often be resolved by identifying and correcting the root cause of the problem.

🔍 Why This Happens

  • The primary reason why this error occurs is that the MySQL server is not listening on the specified IP address. This can happen if the server is configured to only listen on localhost (127.0.0.1) or if there are issues with the network configuration.
  • Another possible cause of this error is that the MySQL server is running, but the socket file used by the client is not correct. In this case, the client may try to connect to a non-existent socket file, resulting in the 'Can't connect' error.

🔧 Proven Troubleshooting Steps

Check and configure network settings

  1. Step 1: Step 1: Check the MySQL server configuration files (my.cnf or my.ini) to ensure that the server is listening on the correct IP address. Look for the 'bind-address' or 'skip-networking' directives.
  2. Step 2: Step 2: If the server is configured to listen on a specific IP address, verify that this IP address matches the one specified in the client connection string (in this case, 192.168.1.100).
  3. Step 3: Step 3: If necessary, update the MySQL server configuration file to include the correct IP address and restart the server for the changes to take effect.

Check socket file permissions and ownership

  1. Step 1: Step 1: Check the permissions and ownership of the socket file used by the client. The socket file should be owned by the MySQL user and have read and write permissions for that user.
  2. Step 2: Step 2: If the socket file has incorrect permissions or ownership, update them to ensure that the client can access the correct socket file.

🎯 Final Words

To resolve the 'Can't connect to MySQL server error 111' issue, first check and configure your network settings to ensure that the MySQL server is listening on the correct IP address. If necessary, check the socket file permissions and ownership to ensure that the client can access the correct socket file. By following these steps, you should be able to establish a successful connection with your MySQL server.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions