note 54568 rejected from function.pdo-construct by mazzanet

From: Date: Fri, 08 Jul 2005 06:15:18 +0000
Subject: note 54568 rejected from function.pdo-construct by mazzanet
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-91629@lists.php.net to get a copy of this message
Note Submitter: jxyuhua at yahoo dot com dot cn ---- 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?

« previous php.notes (#91629) next »