| View previous topic :: View next topic |
| Author |
Message |
pweil
Joined: 07 Feb 2007 Posts: 6
|
Posted: Thu Mar 01, 2007 4:08 am Post subject: MDB2 and socket |
|
|
I'm slowly moving from DB to MDB2... I'd like to take advantage of the Unix domain socket for connecting to MySQL. First, do I need to specify the socket path (/tmp/mysql.sock), or does PEAR MDB2 override 'localhost' and try to connect to the local socket on its own, as does mysql_connect <http://www.php.net/function.mysql-connect>?
Second, if the socket path must be specified, then I am a bit confused about the exact syntax I need to use. For example, this $dsn works for PEAR DB, but not for MDB2 (which returns the error: MDB2 Error: Array)
| Code: | | $dsn = 'mysql://username:password@/tmp/mysql.sock/database'; |
What is the correct way to indicate the socket path?
Thanks, pw |
|
| Back to top |
|
 |
mark

Joined: 07 Jan 2007 Posts: 998
|
|
| Back to top |
|
 |
pweil
Joined: 07 Feb 2007 Posts: 6
|
Posted: Thu Mar 01, 2007 7:53 pm Post subject: |
|
|
Ok, thanks. Just for the record, I did look at the manual quite a bit before posting, but I guess I'm just a little dense (that happens to me with manuals for some reason). I went back at it this this morning and was able to get it to work.
And I take it from your reply that PEAR does indeed require you to specify a socket, unlike mysql_connect. I hope that the rest of my adjusting to MDB2 isn't as disorienting as this has been.  |
|
| Back to top |
|
 |
mark

Joined: 07 Jan 2007 Posts: 998
|
Posted: Thu Mar 01, 2007 9:34 pm Post subject: |
|
|
| pweil wrote: | | And I take it from your reply that PEAR does indeed require you to specify a socket, unlike mysql_connect. |
No, it is not required. I'm using MDB2 and a MySQL database without specifying a socket. The need to specify a socket depends on your installation. |
|
| Back to top |
|
 |
pweil
Joined: 07 Feb 2007 Posts: 6
|
Posted: Fri Mar 02, 2007 4:14 pm Post subject: |
|
|
| mark wrote: | | pweil wrote: | | And I take it...that PEAR does... require you to specify a socket, unlike mysql_connect. |
No, it is not required. I'm using MDB2 and a MySQL database without specifying a socket. The need to specify a socket depends on your installation. |
Now you've piqued my curiosity. What about the installation determines whether you need to specify a socket? FWIW, we're running PHP5x/PEAR 1.5/MDB2/MDB2_Driver_mysql, MySQL5x and Fedora core 6. It's not a big deal, but if we can get away with using just 'localhost' and still utilize the UDG socket, it might make things a little easier/simpler.
Thanks again. |
|
| Back to top |
|
 |
mark

Joined: 07 Jan 2007 Posts: 998
|
Posted: Fri Mar 02, 2007 5:04 pm Post subject: |
|
|
| pweil wrote: | | Now you've piqued my curiosity. What about the installation determines whether you need to specify a socket? FWIW, we're running PHP5x/PEAR 1.5/MDB2/MDB2_Driver_mysql, MySQL5x and Fedora core 6. It's not a big deal, but if we can get away with using just 'localhost' and still utilize the UDG socket, it might make things a little easier/simpler. |
I'm sorry, I can only tell you that I don't need to specify a socket - neither on my local Windows machine, nor on about a dozen external Linux machines. The MySQL manual might tell you more about the different installation options. |
|
| Back to top |
|
 |
|