Jump to content


Photo

PHP wrong MySql Socket


  • Please log in to reply
1 reply to this topic

#1 g0itp1

g0itp1
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 12 April 2006 - 08:41 PM

Hi,

I hope you can help, I've been struggling for some time now, the problem is, PHP reports it can't connect to the mysql database viia /tmp/mysql. However the socket for the database is /var/run/mysqld/mysqld.sock.

Mysql report this as correct, the my.cnf file has the correct socket, but the php is apparently trying to connect via the default socket?

can anyone point me in the right direction, is it a global setting that is overriding?

the system is Deebian, MySql 5, PHP4, Apache 2

Thanks



#2 craygo

craygo
  • Staff Alumni
  • Advanced Member
  • 1,973 posts
  • LocationRhode Island

Posted 12 April 2006 - 08:52 PM

if you are not connecting to default socket then you can manually enter it in your connection string with the host name.

$host = "127.0.0.1:3307";
$user = "someuser";
$password = "somepassword";
$dbname = "somedatabase";

$mysql_conn = mysql_connect($host, $user, $password);
mysql_select_db($dbname, $mysql_conn) or die(mysql_error());

Ray






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users