MySQL host access ip confusion

Discussion in 'General troubleshooting' started by wrath, Mar 22, 2009.

  1. I am trying to give my discountasp.net hosted site host access so it can communicate with an MySQL server hosted else where.

    I was able to input my home IP as an access host and can now connect to the MySQL from home, but I cant connect from my website.

    I tried the site name, the longer alt site name and also I pinged my site and tried the ip that was returned, all without success.

    Does anyone know what ip I need to give host access to inorder to allow connection from my discountasp hosted site to this MySQL.

    thanks
     
  2. It should be the IP address of your MySQL server. Do you have a firewall or NAT setup on your network?
     
  3. mjp

    mjp

    Actually, I think if they are trying to connect to an out-of-network MySQL server it would be the IP of our server, since it is sending the request to the database server.

    I saw your ticket yesterday, and you have the correct server IP, so it should work.
     
  4. Its still not working...

    I have 2 external MySQL servers.

    One requires no host access list and my website can connect with out issue.

    The other requires host access list. Working in dev environment at home, I had to add my home IP to the access list in order to allow connection to the MySQL server. I added the IP of my website but it doesnt work when running on discountasp server.

    So I can connect to the other MySQL without issue from discountasp. The only change to make it switch between MySQL servers is changing the connection string. I can connect when running at home with any of the connection strings. I have added my home address and IP of my site yet it still wont connect.

    Unless there is some technical issue I am not understanding, it seems to me that when my web service trys to communicate with the MySQL it is using a different IP than the one my site identifies itself as.

    Can I set up custom error page that would display the actual rejection message from the MySQL server? Does anyone have a link explaining how to do this?

    Is there a list of IP's I could try to see if allowing access to them gets me connected?

    thanks
     
  5. There can be two IP address associated with your discountasp account. One can be the incoming IP address which is the IP address you see in the hosting control panel and the other is the servers IP address. The best way to find out the servers IP address is to directly ping the server itself. Find your alternative URL in your hosting control panel. The format should look like [account name].[web server name].discountasp.net. The one you want to ping is [web server name].discountasp.net. The IP address it resolves to is the outbound IP address.

    Not sure about the custom error page that will display the rejection message from the MySQL database. What I would first do is simply create a simple test script to connect to the remote MySQL server. Do a simple query and run that script. It doesn't matter if a .asp or .aspx page if they can connect then your web service should also have the ability to connect to it. I know this is kinda of tedious but sometimes taking the time to create something simple as a test can help you troubleshoot more complicated applications in the long run.
     
  6. is there a reason this runs fine

    <?php echo "Hello world!"; ?>

    but this throws error 500

    <?php
    $link = mysql_connect("mysqlIP", "user", "password");

    mysql_select_db("dbname", $link);
    echo mysql_errno($link) . ": " . mysql_error($link). "\n";

    mysql_select_db("teams", $link);
    mysql_query("SELECT * FROM teams", $link);
    echo mysql_errno($link) . ": " . mysql_error($link) . "\n";
    ?>

    was hoping that would capture the mysql error but it looks like its not even running
     
  7. After some investigation it turns out this was a classic PEBKAU situation.

    Using the code described here

    http://www.dreamincode.net/code/snippet1677.htm

    I created an asp webpage that was fetching data from the db... So the problem was some where in my code. The only code I was changing was a variable referring to a connection string in my web.config file. I never uploaded the new web.config...

    I need to get in the habit of using VS to publish my web files instead of build then drag new dll's to bin folder in ftp app...

    Thank you raymond for your suggestion

    edit: I am still curious why the php mysql_connect() wouldnt work...?
     

Share This Page