I know that this question looks duplicate with many others, but before you downvote me, I already read about others related questions but didn't solve my problem. Please take a look about my environment:

$ ps -Af | grep mysqld
mysql      901     1  0 10:11 ?        00:00:00 /usr/sbin/mysqld
ubuntu    3229  2542  0 10:13 pts/0    00:00:00 grep --color=auto mysqld  

More output:

# netstat -lnp | grep mysql
tcp        0      0
unix  2      [ ACC ]     STREAM     LISTENING     19274    901/mysqld           /var/run/mysqld/mysqld.sock

I think this will be useful too:

$ cat /etc/mysql/mysql.conf.d/mysqld.cnf | grep bind-address
bind-address =

There is no skip-networking option active, but even so, I can access the MySQL through local socket connection!

Already added 3306 to ufw allow-list, and even more, tried to connect with ufw disabled.

neither, or my lan ip or works, I keep getting the same output error:

ERROR 2003 (HY000): Can't connect to MySQL server on '' (97)

Here is the nmap on port 3306:

# nmap -sS -O -p3306
3306/tcp open  mysql

The telnet output:

$ telnet 3306
Connected to
Escape character is '^]'.
5.7.21-0ubuntu0.17.10.1!5GAC"?0)kLQBLmysql_native_passwordConnection closed by foreign host.

A few interesting lines on the error.log:

2018-04-12T13:28:58.588887Z 0 [Note] Server hostname (bind-address): ''; port: 3306
2018-04-12T13:28:58.588895Z 0 [Note]   - '' resolves to '';
2018-04-12T13:28:58.588919Z 0 [Note] Server socket created on IP: ''.
2018-04-12T13:28:58.593960Z 0 [Note] Event Scheduler: Loaded 0 events
2018-04-12T13:28:58.594091Z 0 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.7.21-0ubuntu0.17.10.1'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  (Ubuntu)

In my point of view, it should be working fine... Any help will be welcome!



Added the iptables output after been requested. # iptables -L Chain INPUT (policy ACCEPT) target prot opt source destination

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination  
  • Right, we need to know what client is trying to connect to MySQL, and how it is configured to do so. Commented Apr 12, 2018 at 21:09
  • I'm trying to use mysql-client 5.7 with a simple: $ mysql -u root -p -h Commented Apr 12, 2018 at 23:13
  • You have GRANTed the root user permission to connect remotely, haven't you...? Commented Apr 12, 2018 at 23:42
  • I Think I didn't, how do I check in a easy way if I had? In the cnf file? Commented Apr 13, 2018 at 19:39

1 Answer 1


Comment out the bind-address line. Commenting out that line will force the MySQL server to accept connections regardless of origin. In theory setting should do the same however I personally have had difficulties with that before.

Commenting out the bind address line will mean there is no questions about whether or not the change stuck. Comment how this goes, we’ll find you a solution one way or another

  • Hi Timothy, i did comment the bind-address line in the cnf file, but I'm still getting the same behavior and output for the commands that I presented on the question. =/ Commented Apr 12, 2018 at 23:19
  • @Mateus and restarted MySQL...? Commented Apr 12, 2018 at 23:32
  • Yes, and rechecked the error.log file. Nothing relevant happened. Commented Apr 13, 2018 at 19:38
  • Can you also try iptables -L and check the ufw stuff is actually in there and enabled Commented Apr 13, 2018 at 19:40
  • I think there are no routes, added the output of the command on the question. Commented Apr 15, 2018 at 21:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .