I try connect to mysql DB with PDO, but does not work. i write:
$db = new PDO('mysql:dbname=test;host=localhost','user','pass');
returns error:
Warning: PDO::__construct() [pdo.--construct]: [2002] No connection could be made because
the target machine actively refused it.
please tell me , wath the PDO wants to?
phpversion: 5.3.9
host: local computer, (server - "usbwebserver")
It's a port problem. USBwebsever uses mysql port 3307 instead of 3306, so use $db = new PDO('mysql:dbname=test;host=localhost:3307','user','pass');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With