note 54568 added to function.pdo-construct
| From: | jxyuhua at yahoo dot com dot cn | Date: | Fri, 08 Jul 2005 01:59:12 +0000 |
| Subject: | note 54568 added to function.pdo-construct | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-91622@lists.php.net to get a copy of this message | ||
how can i connect mysql with special port eg.3307?
i test it like this:
$dsn = 'mysql:host=localhost;dbname=test';
$user = 'root';
$password = '123456';
try {
$dbh = new PDO($dsn, $user, $password, array('port'=>'3307'));
} catch (PDOException $e) {
die('Connection failed: ' . $e->getMessage());
}
it show wrong message:
-----------------------------------------------
Connection failed: SQLSTATE[28000] [1045] Access denied for user
'root'@'localhost' (using password: YES)
but i can connect it successfully under command line, why?how can i do it?
----
Manual Page -- http://www.php.net/manual/en/function.pdo-construct.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+54568
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+54568&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+54568&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+54568&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+54568&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+54568&report=yes&reason=non-english
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+54568&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+54568&report=yes
Search -- http://master.php.net/manage/user-notes.php