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=; Initial Catalog= databasename; uid=useid; password=****";

    using (MySqlConnection conn = new MySqlConnection(CS))
        Response.Write("Connection Established");

migrated from stackoverflow.com Feb 22 '16 at 19:11

This question came from our site for professional and enthusiast programmers.

  • 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 '16 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 '16 at 5:41
  • thanks Niagaradad , can you tell me please is there any other option available to make remote connections . – Gautam Reloaded Feb 9 '16 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 '16 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 '16 at 18:26

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.