Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am currently using ubuntu server on a virtual box machine to have a secondary environment for testing. The server also has mysql-server installed but I would like to manage it through mysql workbench on my host machine except when trying to connect the the remote host I am refused a connection.

HOST:

telnet 192.168.56.8 3306
Trying 192.168.56.8...
Connected to 192.168.56.8.
Escape character is '^]'.
EHost '192.168.56.1' is not allowed to connect to this MySQL serverConnection closed by foreign host.

Trying to connect

mysql -h 192.168.56.8:3306 -u root
ERROR 2005 (HY000): Unknown MySQL server host '192.168.56.8:3306'

VBOX:

mysql.cnf

[client]
port            = 3306
...

[mysqld]
bind-address            = 192.168.56.8
...

/etc/network/interfaces

auto eth0
iface eth0 inet dhcp
auto eth1
iface eth1 inet static
address 192.168.56.8
netmask 255.255.255.0

checking port

netstat -l --numeric-ports | grep 3306
tcp        0      0 192.168.56.8:3306       0.0.0.0:*               LISTEN
share|improve this question
    
What are your network configurations on the VM? –  criziot Jun 21 '12 at 14:16
    
everything below "VBOX:" in the question. I can pink the server fine from my host machine and serve websites but no luck with mysql remote connection. –  Adgezaza Jun 21 '12 at 14:23
    
answer: mysql> GRANT ALL PRIVILEGES ON . TO 'root'@'192.168.56.1'; Query OK, 0 rows affected (0.00 sec) mysql> FLUSH PRIVILEGES; Query OK, 0 rows affected (0.01 sec) –  Adgezaza Jun 21 '12 at 14:48

3 Answers 3

You said you tried to connect like this

mysql -h 192.168.56.8:3306 -u root
ERROR 2005 (HY000): Unknown MySQL server host '192.168.56.8:3306'

The IP and the port are supposed to be separate

mysql -h 192.168.56.8 -P3306 -u root

Since the default port for mysql is 3306, you need not specify it

mysql -h 192.168.56.8 -u root
share|improve this answer

3306 is default mysql port. So your command should be like this:

mysql -h 192.168.56.8 -u root

Otherwise, you can try this on your mysql server:

iptables -F (the iptables restored when the machine is restarted)

or

iptables -A INPUT -i eth0 -p tcp -m tcp --dport 3306 -j ACCEPT

then try to connect again.

share|improve this answer
grant all on *.* to root@'192.168.56.1'
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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