1

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 127.0.0.1:3306: Can't connect to MySQL server on '127.0.0.1' (111)

Then it gives me a list with things to check.

1 Check that mysql is running on server 127.0.0.1

check

2 Check that mysql is running on port 3306

check

3 Check the root has rights to connect to 127.0.0.1 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
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html

#
# * 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 127.0.0.1 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.

  • Welcome to the site. You are connecting the MySQL Server through "remotely" or "Native mode". – Md Haidar Ali Khan Apr 14 '18 at 14:16
  • Try to bind IP "bind-address = 127.0.0.1" and also "skip-networking" in your "my.cnf" file. And after that run the command "sudo service mysql restart" then try to connect. – Md Haidar Ali Khan Apr 14 '18 at 14:24
  • I add these two lines to my my.cnf bind-address=127.0.0.1 (line 23) and skip-networking (line 24). When I restart mysql it returns two errors in sudo journalctl -xe: mysqld: [ERROR] Found option without preceding group in config file /etc/mysql/my.cnf at line 23! mysqld: [ERROR] Fatal error in defaults handling. Program aborted! – antimatter Apr 28 '18 at 16:54
  • I sorted the errors out when restarting mysql. I needed to precede the directives with [mysqld]. Now it restarts without errors but I still can't connect. – antimatter Apr 29 '18 at 8:20
0

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.

  • I would prefer a solution where I don't have to store the password, but at least this is the first time after months where I was able to connect via mysql-workbench. Thanks – antimatter Jan 9 at 18:59
0

The error message says clearly the MySQL server could not be reached, hence check everything that could block access to it. This is not user related.

  1. Do you have a running network adaptor on the machine you run Workbench on? Does it allow TCP/IP connections?
  2. Can you reach the target machine your MySQL runs on?
  3. Does MySQL run on that target machine?
  4. Can you create an SSH tunnel to the target machine?
  5. Can you reach the MySQL server when you are logged in on the target machine (e.g. by means of an SSH)?

If you can answer all that with yes there should be no problem connecting to the MySQL server from MySQL Workbench. Point 6 can be a bit more complicated, if your MySQL server is not on the same machine as where the SSH endpoint is or if it has networking disabled or if it uses a different port than what you tried.

However, the general idea should be clear now. Try to isolate the actual problem (is it network related or a config problem?). Maybe this video can also help you: https://www.youtube.com/watch?v=DCgRF4KOYIY&t=76s

  • Sorry for my late answer. 1. Yes, connecting from my machine at work, works flawlessly. 2. Yes. 3. Yes. 4. Yes. 5. Yes. – antimatter Apr 25 '18 at 15:29
0

Go to /etc/mysql/mysql.conf.d/mysqld.cnf, and change:

bind-address = 127.0.0.1

to:

#bind-address = 127.0.0.1
-1

I am facing the same issue. As weird as it can get I found that I can only connect to the server using the "Topbar -> Database -> Connect to Database..."

enter image description here

Give it a try. This definitely seems a Workbench's bug. My version is 6.3.10

  • Connecting via the menu is exactly the same as connecting using a tile. – Mike Lischke Apr 15 '18 at 8:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.