BlazE
BlazE

Reputation: 91

"Host 'xxx.x.xx.xx' is not allowed to connect to this MySQL server"

In C#, windows forms, I'm trying to connect to a web server (for testing, 000webhost.com) and whatever I do it keeps saying "Host 'xxx.xxx.xxx.xxx' is not allowed to connect to this MySQL server" (where the X's are my WAN IP address).

If I do this on localhost, then it works perfectly fine, but whenever I try to connect to a database on any web server that exception gets thrown. Why does it do that and how can I fix it?

Upvotes: 0

Views: 2739

Answers (2)

blurstream
blurstream

Reputation: 467

probably there's a mysql configuration which prevents you from connecting outside localhost. you have to bind all addresses permitted to connect to the server and comment out or delete line relative to skip-networking. open your my.cnf configuration file (depends on machine you are on) but it should be on

/etc/mysql/my.cnf

delete bind-address line or set it to this value:

bind-address 0.0.0.0

comment out or delete it:

#skip-networking

reboot mysql server:

service mysql(d) restart

now you should be able to connect to it from any host.

Upvotes: 1

Bernhard Hiller
Bernhard Hiller

Reputation: 2397

You must configure the MySQL server to allow connections from other computers than local host only.

Upvotes: 1

Related Questions