| |||||||||||
Cannot connect to server Posted by jill (jill), 9 April 2003 I am very stuck and would greatly appreciate any help.We have two servers and up to today I have been able to connect to them fine though the connection code is different for the two servers. Also I sometimes connect in the shell of SSH, and sometimes in php pages. Connection code for the first server is as follows (where username and password are replaced as appropriate): In the shell: mysql -h localhost --socket=/tmp/mysql.sock2 -u username -p password In php: $dbh = mysql_connect("localhost:/tmp/mysql.sock2", "username", "password"); Connection code for the second server is: In the shell: mysql -h localhost --socket=/var/lib/mysql/mysql.sock -u username -p password In php: $dbh = mysql_connect("localhost:/var/lib/mysql/mysql.sock ", "username", "password"); Now the last of these has stopped working, and I cannot see why. On the second server I can connect in the shell as shown above, but when I try to connect in the php code with the same uname and pword I get the error message Warning: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock ' (111) in /home/www/adminoffice/public_html/hold/erfn/erfncreate.php4 on line 31 Any suggestions as to what might have gone wrong would save my sanity TIA. Posted by admin (Graham Ellis), 9 April 2003 Question - what changed at the time it stopped working? Was a new version of MySQL (4.0.12 production came out recently) or PHP (There's a 4.3.2 Release Candidate around) installed? Were any other configurations changed?Nothing shouts at me as obvious ... if sql.safe_mode has been enabled, the PHP user name and password you give are ignored; connection attempted as the user name under which PHP is running, no password. A long shot, but has someone reconfigured the PHP and thought that enabling a "safe mode" woul dbe a good idea Posted by jill (jill), 10 April 2003 Thanks for the reply. It seems to be sorted now - I still do not know what was going wrong, I cannot see a mistake in the code - but probably my fault somewhere along the line. This page is a thread posted to the opentalk forum
at www.opentalk.org.uk and
archived here for reference. To jump to the archive index please
follow this link.
|
| ||||||||||
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho |