By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,987 Members | 997 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,987 IT Pros & Developers. It's quick & easy.

Unknown MySQL Server Host 'localhost '

P: n/a
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
Jul 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
>I'm rather new to both MySQL and PHP. I've been trying to use PHP to
write to a MySQL database.
What host is the MySQL database on?
What host is the web server on?
Are the above two on the same host?
I call mysql_pconnect to get a database
connection,
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)
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?


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

Gordon L. Burditt
Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.