0
This is not a duplicate - something is different here.
OS: Ubuntu 18.10 - 4.18.0-25-generic
Mysql Version': mysql Ver 14.14 Distrib 5.7.26, for Linux (x86_64) using EditLine wrapper
I am unable to connect to a "remote" mysql instance on my local network. I have set it up as described in numerous posts, only difference is I have 2 nics in my server.
So far I have:
Set "bind-address = 0.0.0.0" in /etc/mysql/mysql.conf.d/mysqld.cnf
Opened up TCP 3306 on the firewall
I can:
telnet localhost 3306 - and I get some mysql info and some form of prompt
netstat -nltp shows that mysql is bound to 0.0.0.0:3306
Use mysql normally from localhost, ie, mysql -u user -p lets me get into the db as $user just fine.
I can't:
(from remote) mysql -u user -p -h 192.168.0.51 (or on .52, same machine)
Result:
ERROR 2003 (HY000): Can't connect to MySQL server on '192.168.0.51' (113)
(from remote) telnet 192.168.0.51 3306
Result:
Trying 192.168.0.51... telnet: Unable to connect to remote host: No route to host
Even if i set the bind address to one of the NICs IP addresses, I am still unable to remotely connect to it.
"nmap -Pn 192.168.0.51 -p3306" returns that the port is filtered. Other ports can be opened and closed, and provided there is a listening service, I can connect via telnet to that service.
So - I have mysql set up correctly, I think, and I have the firewall set up correctly too.
/etc/mysql/mysql.conf.d/mysqld.cnf is as follows (minus comments):
root@mycloud:~# cat /etc/mysql/mysql.conf.d/mysqld.cnf | egrep -v "^\s*(#|$)"
[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0
[mysqld]
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking
bind-address = 0.0.0.0
key_buffer_size = 16M
max_allowed_packet = 16M
thread_stack = 192K
thread_cache_size = 8
myisam-recover-options = BACKUP
query_cache_limit = 1M
query_cache_size = 16M
log_error = /var/log/mysql/error.log
expire_logs_days = 10
max_binlog_size = 100M
root@mycloud:~#
My ufw status output:
root@mycloud:~# ufw status
Status: active
To Action From
-- ------ ----
22/tcp ALLOW Anywhere
22 ALLOW Anywhere
3306/tcp ALLOW Anywhere
3309/tcp ALLOW Anywhere
3309 ALLOW Anywhere
3306 ALLOW Anywhere
8989/tcp ALLOW Anywhere
22/tcp (v6) ALLOW Anywhere (v6)
22 (v6) ALLOW Anywhere (v6)
3306/tcp (v6) ALLOW Anywhere (v6)
3309/tcp (v6) ALLOW Anywhere (v6)
3309 (v6) ALLOW Anywhere (v6)
3306 (v6) ALLOW Anywhere (v6)
8989/tcp (v6) ALLOW Anywhere (v6)
root@mycloud:~#
And my netstat output showing that its listening correctly:
root@mycloud:~# netstat -nltp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 21396/mysqld
tcp 0 0 0.0.0.0:139 0.0.0.0:* LISTEN 2017/smbd
tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 1189/utserver
tcp 0 0 127.0.0.1:10000 0.0.0.0:* LISTEN 1189/utserver
tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN 1448/systemd-resolv
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1910/sshd
tcp 0 0 0.0.0.0:445 0.0.0.0:* LISTEN 2017/smbd
tcp 0 0 0.0.0.0:8989 0.0.0.0:* LISTEN 1138/mono
tcp 0 0 0.0.0.0:6881 0.0.0.0:* LISTEN 1189/utserver
tcp 0 0 0.0.0.0:10050 0.0.0.0:* LISTEN 1657/zabbix_agentd
tcp 0 0 127.0.0.1:39621 0.0.0.0:* LISTEN 1637/containerd
tcp 0 0 0.0.0.0:7878 0.0.0.0:* LISTEN 1227/mono
tcp6 0 0 :::139 :::* LISTEN 2017/smbd
tcp6 0 0 :::80 :::* LISTEN 2373/apache2
tcp6 0 0 :::8080 :::* LISTEN 1189/utserver
tcp6 0 0 :::21 :::* LISTEN 1638/vsftpd
tcp6 0 0 :::22 :::* LISTEN 1910/sshd
tcp6 0 0 :::445 :::* LISTEN 2017/smbd
tcp6 0 0 :::6881 :::* LISTEN 1189/utserver
tcp6 0 0 :::10050 :::* LISTEN 1657/zabbix_agentd
root@mycloud:~#
Why cant I connect? I'm happy to close this off if someone can spot an easy error - I cant.
Internet hugs to anyone who can assist.