Problem with PDO_MYSQL
Posted: 31. August 2009 22:02
I have installed "XAMPP for linux 1.7.2" on fedora11 (2.6.29.6-217.2.16.fc11.i686.PAE) and tryed to use PDO_MYSQL:
and got error:
How can i fix it?
Thanks.
- Code: Select all
try {
$dbh = new PDO('mysql:host=localhost;dbname=db', 'root', '');
foreach ($dbh->query('SELECT * from good') as $row) {
print_r($row);
}
$dbh = null;
} catch (PDOException $e) {
print "Error!: " . $e->getMessage() . "<br/>";
die();
}
and got error:
- Code: Select all
Warning: PDO::__construct() [pdo.--construct]: [2002] (trying to connect via unix://) in /opt/lampp/htdocs/public/index.php on line 30
Error!: SQLSTATE[HY000] [2002]
How can i fix it?
Thanks.