0

Configuration:

Mac OS X 10.9.3
PHP 5.4.24 (default)
MySQL 5.6.17
pear list:
    MDB2              2.4.1   stable
    MDB2_Driver_mysql 1.4.1   stable
    PEAR              1.9.4   stable

I have a database in place on localhost and it's accessible with a particular account and password:

% mysql -u stacks -p password
mysql> use redseaexp_radtags;
Database changed
mysql> ^D

But:

% php -a
php > require_once("/usr/local/share/pear/MDB2.php");
php > $dsn = 'mysql://stacks:password@localhost/redseaexp_radtags';
php > $options = array();
php > $dbh = MDB2::connect($dsn, $options);
php > echo($dbh->getMessage() . "\n");
MDB2 Error: connect failed
php > echo($dbh->getUserInfo() . "\n");
connect: [Error message: No such file or directory]
[Native code: 2002]
[Native message: No such file or directory]
 ** mysql(mysql)://stacks:xxx@localhost/redseaexp_radtags
php > ^D

I don't see any issues with this code, but I could be missing something; the same errors occur if I leave off '/redseaexp_radtags'.

Is there perhaps a software compatibility issue?

Andy Anderson
  • 51
  • 1
  • 3
  • mdb2, really? Oh my... – Ray May 29 '14 at 21:33
  • Does connecting via command line localhost work with `mysql -u stacks -ppassword -h localhost redseaexp_radtags` ? – Ray May 29 '14 at 21:37
  • Re: “Oh my…" Is there a problem with using MDB2? – Andy Anderson Jun 21 '14 at 18:29
  • Re: “Does connecting via command line localhost work” Yes: mysql> show tables; +-----------------------------+ | Tables_in_redseaexp_radtags | +-----------------------------+ | alleles | | batches | | catalog_alleles | | catalog_annotations | | catalog_genotypes | | catalog_snps | | catalog_tags | | chr_index | | fst | | ... | +-----------------------------+ 21 rows in set (0.00 sec) – Andy Anderson Jun 21 '14 at 18:32
  • OK, found the answer: the file or directory that's missing is the socket file. Read more here: http://stackoverflow.com/questions/1676688/php-mysql-connection-not-working-2002-no-such-file-or-directory – Andy Anderson Jul 03 '14 at 20:11

0 Answers0