Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.


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

Trying to connect

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



port            = 3306

bind-address            =


auto eth0
iface eth0 inet dhcp
auto eth1
iface eth1 inet static

checking port

netstat -l --numeric-ports | grep 3306
tcp        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'@''; 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

You said you tried to connect like this

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

The IP and the port are supposed to be separate

mysql -h -P3306 -u root

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

mysql -h -u root
share|improve this answer
grant all on *.* to root@''
share|improve this answer

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

mysql -h -u root

Otherwise, you can try this on your mysql server:

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


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

then try to connect again.

share|improve this answer

Your Answer


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.