MySQL Workbench "Unable to connect to localhost" error on Windows 10 but I am NOT trying to connect to localhost
Asked Answered
E

1

6

I hope someone can help me. I was using MySQL Workbench on Windows 7 for years, but now I got a new machine on Windows 10, I installed MySQL Workbench but when I try to connect to a database I always get the same error "Unable to connect to localhost" but I am not trying to connect to localhost but to another DB server. Telnet to the server on port 3306 works fine but MySQL Workbench doesn't even try to connect to the server - it immediately spews the error. The log just says:

13:21:04 [ERR][SQL Editor Form]: SqlEditorForm: exception in do_connect method: Exception: Unable to connect to localhost

13:21:04 [ERR][ GRTDispatcher]: exception in grt execute_task, continuing: Exception: Unable to connect to localhost

13:21:04 [ERR][ GRTDispatcher]: worker: task 'execute sql queries' has failed with error:.Unable to connect to localhost

13:21:04 [ERR][ WQE backend]: Got an exception during connection: Unable to connect to localhost

13:21:04 [ERR][SQL Editor Form]: SQL editor could not be connected: Unable to connect to localhost

13:21:04 [ERR][SQL Editor Form]: Your connection attempt failed for user 'MyUser' to the MySQL server at MyDBserverIP:3306: Unable to connect to localhost

Can someone please tell me why is it trying to connect to localhost (if that is even what it is doing) when I am configuring a different IP address? Thank you in advance.

Essary answered 6/6, 2022 at 11:0 Comment(3)
Please check dev.mysql.com/doc/workbench/en/… on how to manage the server connections you want to use.Dummy
DO you have locahost defined? Do a ping -4 localhost from a command windowsSeismo
The Standard TCP/IP Connection Method is no brainer - you just put an IP address, port and username. I use the same settings as the working ones on Windows 7. I have "localhost" defined - the ping works fine but I have NO SQL server on the localhost.Essary
D
0

Make sure you set the bid-address property of the MySQL configuration file in the target server (host).

The location in ubuntu is the following:

/etc/mysql/mysql.conf.d/mysqld.cnf

Search for this section:

# If MySQL is running as a replication slave, this should be
# changed. Ref https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_tmpdir
# tmpdir                = /tmp
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address            = 127.0.0.1
mysqlx-bind-address     = 127.0.0.1

and edit accordingly.

If you want to allow all ips to connect to you server, you can edit to 0.0.0.0

Dodgem answered 30/8, 2024 at 22:40 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.