Thursday, November 11, 2010

message from server: "Host is not allowed to connect to this MySQL server"

Today I came across the problem for remotely connecting to MYSQL database from an application hosted on different machine.

Solution for this issue is to run the following query for granting privileges  to desired user:

GRANT ALL PRIVILEGES ON *.* TO '<USER_NAME>'@'%' IDENTIFIED BY '<PASSWORD>' WITH GRANT OPTION;

Enjoy!!!

1 comment:

AR said...

Perfect usage is like if you know which IP address is going to access it:

GRANT ALL PRIVILEGES ON *.* TO 'root'@'10.50.168.44' IDENTIFIED BY '' WITH GRANT OPTION;