0

I have hosted my MySQL database on https://www.000webhost.com/ . I tried connecting the same using C# code , but getting error like Host "my ip" is not allowed to connect to this MySQL server . Please suggest me , any help would be greatly appreciated . Thanks

Code :

protected void Page_Load(object sender, EventArgs e)
{
    String CS = @"Data Source=31.170.160.102; Initial Catalog= databasename; uid=useid; password=****";

    using (MySqlConnection conn = new MySqlConnection(CS))
    {
        conn.Open();
        Response.Write("Connection Established");
    }
}
5
  • you should ask your hosting service provider to give you permission to connect from your ip. It is nothing to do with coding and sorry, we cannot help you on this
    – bansi
    Feb 9, 2016 at 4:56
  • most shared hosting services do not allow remote connections to databases for security reasons. so your code would have to be on the same machine on your webhost and you would connect to localhost instead.
    – Niagaradad
    Feb 9, 2016 at 5:41
  • thanks Niagaradad , can you tell me please is there any other option available to make remote connections .
    – Gautam Reloaded
    Feb 9, 2016 at 5:55
  • Also, you can probably do this yourself if you have access to that mysql server using a tool like phpmyadmin provided by that hosting service provider and you can create the user in mysql to allow you to connect from your site server IP.
    – Mihail Stancescu
    Feb 9, 2016 at 7:13
  • People pay a little bit for functionality like this. I am not going to say anything disparaging about the host provider you chose, but use your imagination. There are others I could recommend for direct connects, but only in stackoverflow chat which you need a rep of 20 for. Plus it is not free each month. Well chat is free, but the hosts aren't :P
    – Drew
    Feb 13, 2016 at 18:26

0

You must log in to answer this question.