Jump to content

Pear connecting to mysql using a different socket


Recommended Posts

hi all,

 

m currently using the PEAR module of php4.06 on top of redhat. Our provider implemented a new installation for mysql wherein the mysql.sock file was created in another directory instead of the default (\'/tmp/mysql.sock). Using mysql_connect, this was achieved using localhost:/path/to/socket but this could not be achieved using pear class ; DB::connect(\"mysql://$dbuser:$dbpass@$dbhost:/path/to/socket/$dbname\"). I\'ve tried enclosing it in single quotes etc... it can\'t connect to that socket i think because of the forward slash (/). Any ideas? couldn\'t change the location of the mysql sockets coz we are only hosting it their.

 

All help would be very much appreciated.

 

thanks

In the doc of PEAR :: DB, there is the following example:

Connect to database through a socket:

mysql://user:pass@unix(/path/to/socket)/pear

So basically, in your case you would have:

mysql://$dbuser:$dbpass@tcp(/path/to/socket:port):/$dbname"

Hope this helps.

 

JP.

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.