php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #39672 Cannot connect to socket
Submitted: 2006-11-29 00:59 UTC Modified: 2006-11-29 11:32 UTC
From: acct dot php at povpromotions dot com Assigned:
Status: Not a bug Package: PDO related
PHP Version: 5.2.0 OS: apache
Private report: No CVE-ID: None
 [2006-11-29 00:59 UTC] acct dot php at povpromotions dot com
Description:
------------
My ISP has implemented both MySQL4 and MySQL5.  Because of this, I have to connect to the MySQL5 database using a socket port on the connect:  localhost:/tmp/mysql5.sock

However, PDO fails to connect when I use this.

I have tried both:

$dbH = new PDO('mysql:host=localhost:/tmp/mysql5.sock;dbname='.DBASE, DBUSER, DBPWORD );

$dbH = new PDO('mysql:host=localhost;port=/tmp/mysql5.sock;dbname='.DBASE, DBUSER, DBPWORD );

The first returns this error:
Exception message: SQLSTATE[HY000] [2005] Unknown MySQL server host 'localhost:/tmp/mysql5.sock'

The second returns this error:
SQLSTATE[00000] [1044] Access denied for user: '*****@localhost' to database '*****'
which means it is pointing to the old MySQL4 db and is not using the port.

I use many other connection methods that work fine with host="localhost:/tmp/mysql5.sock"

Any help would be appreciated.

dbrucas





Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-11-29 11:32 UTC] tony2001@php.net
http://www.php.net/manual/en/ref.pdo-mysql.connection.php

The PDO_MYSQL Data Source Name (DSN) is composed of the following elements: 
<.....>
unix_socket
The MySQL unix socket (shouldn't be used with host or port).
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 27 02:01:29 2024 UTC