Greetings Stackoverflow.
I am currently using 000webhost.com as my MySQL database / server provider. Using PHP, their service is working brilliant!
I have made a bunch of variables containing the MySQL username, password, host, DB, et cetra.
Looking as follows:
$mysql_host = "mysql3.000webhost.com";
$mysql_database = "a1966938_AtMarke";
$mysql_user = "a1966938_admin";
$mysql_password = "**********";
$mysql_table = "MarketDatas";
and I am using the “mysql_connect($mysql_host, $mysql_user, $mysql_password);” to connect to the server. Again, all of this is working perfect. However, when I am trying to connect to the database via. Client (C#) it will not let me connect, or if I declare the same variables and tries to connect to the server from another IP with PHP using the same variables and procedures, it will not let me connect?
I am confused – What should I do, so it allows all IPs?
The reasons why it does not allow connection from other IPs may be two:
GRANT PRIVILEGES ... TO user@IPhas been given to that IP but no other; if you have GRANT privileges on the database you might be able to remedy that (remember to FLUSH PRIVILEGES).Usually, you can implement a thin REST layer written in PHP (just google ‘MySQL REST PHP interface’ or such) so that you can connect to the Web hosting, and pass through queries from their interfaces (which are of course open – otherwise the Web hosting wouldn’t work). This is what the HeidiSQL did on some setups, and their code might be floating somewhere. Then you won’t be using the C# MySQL library but rather the HTTP library to do the work. More hassle, but more portable (also because not everywhere you can expect the port 3306/tcp to be outbound open: it is on home ADSLs, but many distributed carriers and companies will only allow outbound ports 80, 443, 110, 25 to some IPs, and a dozen others – and 3306 isn’t among them; but this depends on what you’re planning to do with the C# client).
However, if you get “cannot resolve port”, this might also be caused by the client library and you might have to specify the MySQL connection port value manually; the default value is 3306, and (usually) you can specify it in the host name, such as “myserver.host.com:3306”.