I am trying to get MySQL server (which is inside VM) to respond to client (which is on the host machine). All methods return same:

Host '' is not allowed to connect to this MySQL server

I have ensured proper port forwardind. I also ensured, that in my.cnf I have folowing lines:

bind-address =

This did not work to me. I also tried to play a bit as folowing:

bind-address =

But this also did not work to me - server just could not start.

Any ideas, where I am wrong?

UPDATE. I did not check privilegies for root@% as in How do I change the privileges for MySQL user that is already created?


  • What user accounts have you created within MySQL? – Shane Madden Mar 11 '13 at 16:21
  • My accout is root:root. I doubt that problem is in logins, otherwise error message would state something lile Access denied for root@ or something. – defance Mar 11 '13 at 16:23
  • @ShaneMadden Sorry. You were pretty right. The thing was in privilegies for root@%. Pretty my fault. – defance Mar 11 '13 at 16:30

The root account's localhost-only in the vast majority of default installations, are you certain you've allowed it to log in from the other system? From the MySQL reference manual:

it means that there is no row in the user table with a Host value that matches the client host

So, there's no % or in the Host column at all. Check your current config:

select user,host from mysql.user where user='root';

You likely want to create a new root entry with the same password as you have now.

create user 'root'@'' identified by 'yourpassword';
grant all privileges on *.* to 'root'@'' with grant option;
flush privileges;
| improve this answer | |
  • 1
    Yep. Thank you. I also solved it just a moment ago as you stated here. That was exact my problem. – defance Mar 11 '13 at 16:33
  • 1
    Shane's answer is correct and can be run in a single command, helpful if you are using something like an Ansible script/Vagrant to automate: mysql -e "create user 'root'@'' identified by 'yourpassword'; grant all privileges on *.* to 'root'@'' with grant option; flush privileges;" – KayakinKoder Aug 22 '16 at 19:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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