Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: remote mysql connection host error

  1. #1
    Join Date
    Sep 2006
    Location
    Pakistan
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default remote mysql connection host error

    mysql_connect(): Can't connect to MySQL server on 'www.myweb.com (10061) in d:\accounts\myweb\db_connect.php

    i am getting this error while trying to connect to my sql server host from the php form please help


    thanks

    Jamal

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Your php code is wrong. Post it. Remove passwords/usernames first, though.
    Daniel - Freelance Web Design | <?php?> | <html>| espaņol | Deutsch | italiano | portuguęs | catalā | un peu de franįais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    Sep 2006
    Location
    Pakistan
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    <?php

    define('DB_USER','xyz');
    define('DB_PASS','xyz');
    define('DB_HOST','www.my.com');
    define('DB_NAME','xyz');



    $dbc = mysql_connect(DB_HOST,DB_USER,DB_PASS);

    mysql_select_db(DB_NAME);
    ?>


    now tel me wats wrong wid it ?

  4. #4
    Join Date
    Aug 2005
    Posts
    174
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    try this:

    PHP Code:
    define('DB_HOST','localhost'); 

  5. #5
    Join Date
    Sep 2006
    Location
    Pakistan
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    yes dude i tried it first, and i think the same: there is a problem with either the url i am typing or with my hosting service, because this code is working fine wen i tried it on my local machine.

    need help guys

  6. #6
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    if you are trying to access the mysql from outside of the server hosting it, make sure that they/you have it set up to recieve connections from outside sources (non-localhost).
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  7. #7
    Join Date
    Sep 2005
    Location
    India
    Posts
    1,625
    Thanks
    6
    Thanked 107 Times in 107 Posts

    Default

    Quote Originally Posted by Jamal
    define('DB_HOST','www.my.com');
    Is the above one correct? or its just a spelling mistake

  8. #8
    Join Date
    Sep 2006
    Location
    Pakistan
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    thetestingsite : im trying to access my web host's local server.

  9. #9
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    Quote Originally Posted by Jamal
    thetestingsite : im trying to access my web host's local server.
    i figured that, and from the title I figured that you were attempting to connect from an outside source (i.e.: trying to access the hosted mysql server from your home server/computer) As I siad in my previous post, make sure that you/your provider has it set up to accept connections from outside sources. I have had that problem with my linux server, and the solution was to allow connections from all.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  10. #10
    Join Date
    Jun 2006
    Location
    Acton Ontario Canada.
    Posts
    677
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    NEVER accept from everyone unless you got a Username/password system.

    Mine is Boxxertrumps & the password is alkatraz.

    too bad i wont tell you my domain.... Bwhahahaahaa! i just figured out how to use it too...
    - Ryan "Boxxertrumps" Trumpa
    Come back once it validates: HTML, CSS, JS.

Bookmarks

Posting Permissions

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