List:General Discussion« Previous MessageNext Message »
From:Michael Widenius Date:June 9 1999 3:15pm
Subject:mysqlbug: Can't connect to server with PHP3...
View as plain text  
>>>>> "Ritschie" == Ritschie  <krichard@stripped> writes:

>> Description:
Ritschie> Tried using PHP3's mysql_connect() function, while the mysqld is running.
Ritschie> I checked the user and password is OK.
Ritschie> If I am root (I mean the UNIX user) I can connect by typing:
Ritschie> mysql -u webuser -pmypass.
Ritschie> But if I am only a simple user (I mean UNIX user) then I am unable to
Ritschie> connect.
Ritschie> I need to connect from PHP3. That is the main problem.

Ritschie> The error I get back when trying to connect with mysql_connect()

Ritschie> Warning: MySQL Connection Failed: Can't connect to local MySQL server
Ritschie> through socket '/var/lib/mysql/mysql.sock' (111) in 

Hi!

Does the above socket exists and what is the privilege for the file ?
If it doesn't exists, your PHP isn't compiled to use the same sockets
than mysqld and you have to recompile it!

You may be able to fix this by setting the MYSQL_UNIX_PORT environment 
variable to point to the right socket file (you can find this with
mysqladmin var)

shell> perror 111
Connection refused

grep 111 /usr/include/asm/errno.h
#define ECONNREFUSED    111     /* Connection refused */              

I don't know when you get connection refused;  It may be a privilege
problem on the above socket.  

Regards,
Monty
Thread
mysqlbug: Can't connect to server with PHP3...Ritschie9 Jun
  • mysqlbug: Can't connect to server with PHP3...Michael Widenius9 Jun