Unknown MySQL Server Host 'localhost '

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • jason mazzotta

    Unknown MySQL Server Host 'localhost '

    Hi,
    I'm rather new to both MySQL and PHP. I've been trying to use PHP to
    write to a MySQL database. I call mysql_pconnect to get a database
    connection, but then when I call mysql_db_select , I get the following
    error :

    Unknown MySQL Server Host 'localhost '

    I can connect to the database via the command line ok. Where can I
    look to find the source of this problem?


    Thanks,

    Jason Mazzotta
  • Gordon Burditt

    #2
    Re: Unknown MySQL Server Host 'localhost '

    >I'm rather new to both MySQL and PHP. I've been trying to use PHP to[color=blue]
    >write to a MySQL database.[/color]

    What host is the MySQL database on?
    What host is the web server on?
    Are the above two on the same host?
    [color=blue]
    >I call mysql_pconnect to get a database
    >connection,[/color]

    Did you check whether mysql_pconnect worked?
    What host argument did you pass to mysql_pconnect? Was it "localhost" ?
    Was it "localhost "? (note trailing space, which if it's really there
    is probably a mistake)
    [color=blue]
    >but then when I call mysql_db_select , I get the following
    >error :
    >
    >Unknown MySQL Server Host 'localhost '
    >
    >I can connect to the database via the command line ok. Where can I
    >look to find the source of this problem?[/color]

    Are you running the command line on the same host as the web server
    and the MySQL server?

    Gordon L. Burditt

    Comment

    Working...