MySql-Workbench: Can’t connect to MySQL server on ‘’ (111)


The hard data first:
Local machine: Xubuntu 17.10, with MySql-Workbench 6.3
Remote Machine: Ubuntu 16.04, with MySql-Client 5.7 and MySql-Server 5.7

The connection method is: Standard TCP/IP over SSH

The error:

Your connection attempt failed for user 'root' from your host to
server at Can't connect to MySQL server on
'' (111)

Then it gives me a list with things to check.

1 Check that mysql is running on server


2 Check that mysql is running on port 3306


3 Check the root has rights to connect to from your address

I checked the mysql.user table and it says that root has the host: localhost and since MySql-Workbench does an ssh connect to the remote machine and then connects to the MySql-Server, localhost should be fine.
Nonetheless I tried setting the host to % as a wildcard but that didn't change anything either so I switched back to default localhost.
I also checked the my.cnf. That is the entire content of it:

# The MySQL database server configuration file.
# You can copy this to one of:
# - "/etc/mysql/my.cnf" to set global options,
# - "~/.my.cnf" to set user-specific options.
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
# For explanations see

# * IMPORTANT: Additional settings that can override those from this file!
#   The files must end with '.cnf', otherwise they'll be ignored.

!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mysql.conf.d/

There is no bind-address or skip-networking directive set.

4 Make sure you are both providing a password if needed and using the
correct password for connecting from the host address you're
connecting from

Password and stuff is all fine. Passwords are set, they are typed correctly when logging in.

When I do, what Workbench is supposed to do

  • ssh to the remote machine (ssh user@remotemachine)
  • login to mysql server (mysql -u root -p)

It works flawlessly
I just can't do via MySql-Workbench

Help is much appreciated because I already tried everything I was able to research.

Best Answer

same issue i faced with mysql workbench 6.3.8 build 1228 CE (64-bits) community with kubuntu 18.04 version.

i set connection method standard tcp/ip over ssh and when i try to connect to remote server it asks for ssh password and after successful ssh tunnel it asks for remote mysql password ( which was expected as i did not store passwords in keychain -- option available there in connection window ) and when i entered it i got same above error.

after checking at server mysql log i found this line: Access denied for user 'root'@'localhost' (using password: NO)

but i already entered the password while workbench asks me.

finally i try edit connection and store mysql password there in keychain option and it works fine.