pear DB::connect to mysql fails
| From: | Scott Seong | Date: | Mon, 10 Feb 2003 07:45:05 +0000 |
| Subject: | pear DB::connect to mysql fails | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-3693@lists.php.net to get a copy of this message | ||
Hi,
I have just exposed to pear today, but couldn't get the db connect to work.
I'm running Red Hat 8.0, PHP 4.2.2 and mysql-3.23.52, and pear library
installed in "/usr/share/pear". The php.ini includes pear path in its
include_path. Here is the sample tutorial I have followed from example:
<?php
require_once 'DB.php';
$user = "user";
$pass = "pass";
$host = "localhost";
$db_name = "test";
$dsn = "mysql://$user:$pass@$host/$db_name";
echo $dsn;
$db = DB::connect($dsn);
if (DB::isError($db)) {
die ($db->getMessage() );
}
$db->disconnect();
?>
And, the output is ...
mysql://user:pass@localhost/testDB Error: no such database
The mysql database "test" does exist on the system, and the permission for
"user" has been setup correctly. I am able to access described database
through mysql client and through java jdbc interface. But, I cannot get php
w/ pear to work.
Thanks,
Scott