+ Reply to Thread
Results 1 to 4 of 4

Thread: hostname for mysql if webpage is not hosted by host1free

  1. #1
    Junior Member ahbert is on a distinguished road
    Join Date
    Oct 2011
    Posts
    2

    hostname for mysql if webpage is not hosted by host1free

    Hi

    What should be the hostname for mysql if the webpage is hosted somewhere else? I believe "localhost" is only useful if the webpage is hosted in host1free.

    Thanks.

  2. #2
    Super Moderator Modestas is on a distinguished road Modestas's Avatar
    Join Date
    Jun 2011
    Posts
    1,859

    Re: hostname for mysql if webpage is not hosted by host1free

    Hello,

    Hostname should be server IP. For example, box6 IP will be 94.249.139.3.

  3. #3
    Junior Member ahbert is on a distinguished road
    Join Date
    Oct 2011
    Posts
    2

    Re: hostname for mysql if webpage is not hosted by host1free

    Hi,

    I am still unable to connect with the IP address.

    <html>
    <body>

    <?php

    $con = mysql_connect('94.249.139.6', 'ahbert_test', '4test4test');
    if (!$con)
    {
    $txt="Die loh";
    echo "<p>$txt</p>";
    die('Could not connect: ' . mysql_error());
    }

    ?>
    </body>
    </html>

    Above is returning
    Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'ahbert_test'@'gator276.hostgator.com' (using password: YES) in /home/timyeo/public_html/wcheng/testdb.php on line 6
    Die loh

    Could not connect: Access denied for user 'ahbert_test'@'gator276.hostgator.com' (using password: YES)

  4. #4
    Super Moderator Modestas is on a distinguished road Modestas's Avatar
    Join Date
    Jun 2011
    Posts
    1,859

    Re: hostname for mysql if webpage is not hosted by host1free

    Probably you also need to remote hostname from which you are trying to connect. Assuming you are connecting from hostgator, it will be hostgator server IP where your website is hosted. To add remote hostname, go to MySQL Management and click on your database name. Under Access Hosts type in hostgator server IP and click Add Host. That should help.

+ Reply to Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34