At 05:15 PM 10/24/2006, ROGER DEBRY wrote:

I know that this is a common problem, and I have honestly searched
though many forums, faqs,
and mailing list archives for an answer.  I get this message when
trying to connect to a local
MySQL database with the statement

      $db = mysql_connect('localhost', 'myUserID', 'myPassword')
             or die("Could not connect to mysql");

I know that the MySQL server is running, I can connect to it on the
command line with the
MySQL client, using the same user name and password as in the
mysql_connect statement.
I know that the socket is there where it is supposed to be, and that
everyone has read and
execute privileges to it. localhost is defined correctly in my hosts
file. I have tried this with
both the defaults for the socket 's path in, and by explicitly
typing in the path to the socket.
The statement fails with the same error message no matter which I do.

I have tried everything that I have found to look at on the many
forums, etc. that I have looked
at. I am at a loss as what to do next. Any suggestions would be

Thank you
Roger deBry

Well, we don't really have any useful information. A couple of things:

1. Echo the error number and error message which PHP returns. Your die() message masks the error.
2. Use phpinfo() to check that MySQL is enabled in PHP.
3. Check the synatx/parameters for mysql_connect() at
4. You could force a TVP/IP connection by replacing lacalhost with

HTH - Miles

No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.408 / Virus Database: 268.13.11/493 - Release Date: 10/23/2006

PHP Database Mailing List (
To unsubscribe, visit:

Reply via email to