...

View Full Version : Cannot connect Mysql through PHP



satish_j
03-23-2009, 06:14 AM
Iam not able to connect to mysql server through php pages.I get error as


'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /usr/local/apache2/htdocs/openDB.php on line 4
Error connecting to mysql'

However,i can connect to mysql server through command prompt without any issue.
In my.cnf,i have foll setting:


#socket = /var/run/mysqld/mysqld.sock
socket = /tmp/mysql.sock

I have commented original setting of 'var/run/mysqld/mysqld.sock' since the file is getting created at '/tmp/mysql.sock'
bind-address is set to 127.0.0.1
Desperately seeking solution...Any suggestions...

satish_j
03-23-2009, 06:28 AM
I have not created a separate NT ID for mysql with name as 'mysql'.
I am using my ID to access mysql
does this create any problem in connection???

guelphdad
03-23-2009, 04:49 PM
the error message you have posted means the mysql server is not running.

satish_j
03-24-2009, 07:45 AM
the error message you have posted means the mysql server is not running.
No,I checked mysql server running in background...and can telnet mysql port.
BTW,problem is resolved..it was a case of missing php.ini in /usr/local/lib folder.
I had compiled PHP manually from source.So,the php.ini file was missing from above path.
Copied php-ini.redist to above path and renamed it to php.ini-->restarted apache and prob solved..
Thanks for your reply though,as replies are very scarce in this forum

Fumigator
03-24-2009, 04:05 PM
as replies are very scarce in this forum

You're kidding, right?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum