Jump to content

PHP wrong MySql Socket


g0itp1

Recommended Posts

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

Link to comment
Share on other sites

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

[code]$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());[/code]

Ray

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.