I had the same problem with suse 7.2. I see that the path to mysql.sock
is /var/lib/mysql/mysql.sock. this location of mysql.sock was a leftover
from the mysql that i installed from the distribution. the downloaded
version though stores the mysql.sock in /tmp/mysql.sock - i had to tell
a few of my programs to look for it there. may you need to add a line in
your php program to look for it there

good luck


harry a.
Crazy Linux wrote:
> 
> yes..the /etc/hosts file reads like the following:
> 
> 127.0.0.1     localhost.localdomain  localhost
> 138.xx.xx.xx  mydomain.edu           mymachine
> 
> thanks
> 
> --- Lance Rochelle <[EMAIL PROTECTED]> wrote:
> > is localhost setup correctly in /etc/hosts file?
> > i.e. 127.0.0.1 localhost,
> > if not put that in there and then try again
> >
> > lance
> > ----- Original Message -----
> > From: "Crazy Linux" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Monday, September 10, 2001 2:53 PM
> > Subject: 'localhost' problem
> >
> >
> > > hello all,
> > >
> > > i am running mysql on a red hat linux v7.0 box.
> > when i
> > > am trying to connect to the mysql database to read
> > a
> > > table that is present in the mysql database i am
> > > facing a strange problem. i am able to get into
> > the
> > > database(named 'newone')  to read the table (named
> > > 'namelist') from the command line on the machine
> > that
> > > is running mysql in any of the following ways:
> > > # mysql -u myname -p mypassword
> > > # mysql -u myname -p mypassword -h localhost
> > > # mysql -u myname -p mypassword -h mydomain.edu
> > > All these 3 commands are successful, without
> > returning
> > > an error.
> > > So i have created a php file named 'namelist.php'
> > to
> > > read this 'namelist' table, which reads like the
> > > following:
> > >
> > > <html>
> > > <head>
> > > <title>Name List</title>
> > > </head>
> > > <body>
> > > <?php
> > > mysql_connect ('localhost','myname','mypassword')
> > or
> > > die ('<b>Unable to connect to the database</b>');
> > > mysql_select_db ('newone') or die ('<b>Unable to
> > > connect to the database</b>');
> > > $result = mysql_query ("select * from namelist");
> > > printf ("First Name: %s<br>\n",
> > mysql_result($result,
> > > 0, "firstname"));
> > > printf ("Last Name: %s<br>\n",
> > mysql_result($result,
> > > 0, "lastname"));
> > > ?>
> > > </body>
> > > </html>
> > >
> > > when i run this php script from the browser, it is
> > > producing the following error:
> > >
> > >
> > > Warning: MySQL Connection Failed: Can't connect to
> > > local MySQL server through socket
> > > '/var/lib/mysql/mysql.sock' (111) in
> > > /var/www/html/namelist.php on line 7
> > > Unable to connect to the database
> > >
> > > But if change the 'localhost' to 'mydomain.edu' in
> > > line 7 it shows the contents of the table on the
> > > browser without any glitch. My question is
> > eventhough
> > > if it doesn't complain any thing from the command
> > line
> > > when i specify '-h localhost', why it returns the
> > > above error when i run the script in a browser? i
> > am
> > > able to reach the index.html page from the browser
> > by
> > > typing any of the following, on the same machine:
> > > 127.0.01
> > > localhost
> > > mydomain.edu
> > > 138.xx.xx.xx          <--my ip address
> > >
> > > Can any one please help me with this.
> > >
> > > TIA
> > >
> > > __________________________________________________
> > > Do You Yahoo!?
> > > Get email alerts & NEW webcam video instant
> > messaging with Yahoo!
> > Messenger
> > > http://im.yahoo.com
> > >
> > >
> >
> ---------------------------------------------------------------------
> > > Before posting, please check:
> > >    http://www.mysql.com/manual.php   (the manual)
> > >    http://lists.mysql.com/           (the list
> > archive)
> > >
> > > To request this thread, e-mail
> > <[EMAIL PROTECTED]>
> > > To unsubscribe, e-mail
> >
> <[EMAIL PROTECTED]>
> > > Trouble unsubscribing? Try:
> > http://lists.mysql.com/php/unsubscribe.php
> > >
> > >
> >
> 
> __________________________________________________
> Do You Yahoo!?
> Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger
> http://im.yahoo.com
> 
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
> 
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail <[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to