MySQL Workbench Can't Connect to Localhost? 6 Ways to Fix It
The Unable to connect to localhost error in MySQL Workbench usually occurs because the MySQL server isn’t running, the connection settings are incorrect, or another application uses port 3306.
Follow these steps to restore the connection on Windows 11.
How can I fix Unable to Connect to Localhost in MySQL Workbench?
1. Start the MySQL service
MySQL Workbench cannot connect if the MySQL server isn’t running.
- Press Windows + R, type services.msc, and press Enter.

- Find MySQL80, MySQL84, or another MySQL service.
- Right-click the service and select Start.

- If the service is already running, select Restart.
- Right-click the service, select Properties, and set Startup type to Automatic.
- Open MySQL Workbench and try connecting again.
If you cannot find a MySQL service, check whether you installed MySQL Server. Installing MySQL Workbench alone doesn’t install a database server.
2. Correct the localhost connection settings
Incorrect connection details can prevent Workbench from reaching the database.
- Open MySQL Workbench.
- Right-click your localhost connection and select Edit Connection.
- Set Connection Method to Standard (TCP/IP).
- Change Hostname to 127.0.0.1.
- Set Port to 3306, unless your server uses another port.
- Enter root as the username if you use the default administrator account.
- Click Test Connection and enter your MySQL password.
Using 127.0.0.1 instead of localhost can resolve connection issues caused by hostname resolution.
3. Check whether port 3306 is working
MySQL normally uses port 3306. A port conflict or an inactive server can cause connection errors.
- Open Command Prompt as administrator.

- Run the following command:
netstat -ano | findstr :3306 - Check whether the output shows a process listening on port 3306.
- Note the process ID (PID) and run:
tasklist /FI "PID eq 1234" - Replace 1234 with the actual PID to identify the process.
- If another application uses the port, resolve the conflict or configure MySQL to use another port.
If you change the MySQL server port, update the connection settings in Workbench to match.
4. Check the MySQL configuration file
Incorrect server configuration can prevent MySQL from accepting localhost connections.
- Open File Explorer.
- Navigate to C:\ProgramData\MySQL\ and open your MySQL Server version folder.
- Locate my.ini.
- Open the file in a text editor with administrator permissions.
- Find the [mysqld] section.
- Check that port=3306 matches your Workbench settings.
- Check whether bind-address restricts connections to an unintended address. For a local-only server, 127.0.0.1 is appropriate.
- Save any necessary changes and restart the MySQL service.
Do not change the bind address unless the current setting causes the connection problem.
5. Test MySQL outside Workbench
A command-line connection test helps determine whether the problem involves MySQL Server or Workbench.
- Open Command Prompt.
- Run the following command:
mysql -h 127.0.0.1 -P 3306 -u root -p - Enter your MySQL password.
- If the connection succeeds, reopen MySQL Workbench and check its connection settings.
- If you receive Access denied for user ‘root’, verify your credentials.
- If you receive Can’t connect to MySQL server, check the MySQL service and port again.
If Windows doesn’t recognize the mysql command, run it from your MySQL Server installation’s bin folder.
6. Repair the MySQL Server installation
If the MySQL service won’t start or the server files have problems, repair or reconfigure the installation.
- Open MySQL Configurator if your installation includes it.
- Check the existing server configuration, service name, and port.
- Reconfigure the server if necessary, keeping your existing data directory.
- Restart the MySQL service.
- Test the localhost connection again.
If the service still fails, check the MySQL error log in the configured data directory before reinstalling anything. Back up your databases before making major installation changes.
If MySQL Workbench still cannot connect after these steps, review the server logs or repair the installation before reinstalling. If you also manage Microsoft SQL Server, you can learn how to fix high CPU usage in SQL Server, print SQL Server error messages, or fix SQL Server password change errors.
FAQs
Why does MySQL Workbench show error 2003 (10061)?
Error 2003 (10061) usually means the server refused the TCP connection. Start the MySQL service and verify the hostname and port.
Why can’t MySQL Workbench connect to localhost:3306?
The MySQL server may have stopped, another application may use port 3306, or Workbench may have incorrect connection settings.
Does MySQL Workbench require MySQL Server?
Yes, you need a running MySQL-compatible database server to execute queries. MySQL Workbench serves as the graphical client and doesn’t run the database server itself.
Read our disclosure page to find out how can you help Windows Report sustain the editorial team. Read more
User forum
0 messages