EDIT: I am trying to Mysql from a remote Host:
mysql -u root -p -h 192.168.56.147
But I have this message :
ERROR 2003 (HY000): Can't connect to MySQL server on '192.168.56.147' (111)
I have done this already on my target machine :
iptables -I INPUT -j ACCEPT
When I do a netstat, I have this :
root@opencv:/# netstat -ntlp | grep LISTEN
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 1268/mysqld
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1249/sshd
tcp 0 0 127.0.0.1:6010 0.0.0.0:* LISTEN 1482/0
tcp 0 0 127.0.0.1:6011 0.0.0.0:* LISTEN 1552/1
tcp6 0 0 :::22 :::* LISTEN 1249/sshd
tcp6 0 0 ::1:6010 :::* LISTEN 1482/0
tcp6 0 0 ::1:6011 :::* LISTEN 1552/1
It seems my server is listen internally only, and does not listen from outside.
Here is is my hosts file :
127.0.0.1 localhost
127.0.1.1 opencv
# The following lines are desirable for IPv6 capable hosts
#::1 localhost ip6-localhost ip6-loopback
#ff02::1 ip6-allnodes
#ff02::2 ip6-allrouters
Here is my hosts.allow :
# /etc/hosts.allow: list of hosts that are allowed to access the system.
# See the manual pages hosts_access(5) and hosts_options(5).
#
# Example: ALL: LOCAL @some_netgroup
# ALL: .foobar.edu EXCEPT terminalserver.foobar.edu
#
# If you're going to protect the portmapper use the name "rpcbind" for the
# daemon name. See rpcbind(8) and rpc.mountd(8) for further information.
#
ALL: 192.168.0.0
And telnet does not work either:
root@DEBIANBASE:~# telnet 192.168.56.147 3306
Trying 192.168.56.147...
telnet: Unable to connect to remote host: Connection refused
Following the comment of Alexander K , here is the details of my mysql config:
root@opencv:/# find . -name "my.cnf"
./var/lib/dpkg/alternatives/my.cnf
./etc/mysql/my.cnf
./etc/alternatives/my.cnf
but in every file, there is NO line with "bind-address" options or "skip-networking" option ( I am in Ubuntu 16.10)
After Digging into it, the file is here :
nano /etc/mysql/mysql.conf.d/mysqld.cnf
I edited to have this :
# 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
And then I had this :
root@DEBIANBASE:~# mysql -u root -p -h 192.168.56.147
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'192.168.56.153' (using password: YES)
After adding remote user by doing this on my local MySQL server :
GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.56.153' IDENTIFIED BY 'YOUR PASSWORD' WITH GRANT OPTION;
FLUSH PRIVILEGES;
It worked ! Thanks Alexandre.