nitin1704 has asked for the wisdom of the Perl Monks concerning the following question:
I installed DWIMPerl on my Windows 64bit machine, and it seems that it came pre-installed with DBI and DBD::mysql. Then I went on to install MySQL Server 5.5. Then using a Perl script, I tried to list all the drivers and data sources. But it doesn't show the mysql databases:
#!/usr/bin/perl use warnings; use strict; use DBI; print "Available DBI Drivers and Data Sources:\n\n"; my @drivers = DBI->available_drivers('quiet'); my @sources; foreach my $driver (@drivers) { print "$driver\n"; @sources = eval { DBI->data_sources($driver) }; if($@) { print "\tError: ",substr($@,0,60),"\n"; } elsif (@sources) { foreach(@sources) { print "\t$_\n"; } } else { print "\tNo known data sources\n"; } }
The script generated this output:
Available DBI Drivers and Data Sources: ADO No known data sources DBM DBI:DBM:f_dir=. ExampleP dbi:ExampleP:dir=. File DBI:File:f_dir=. Gofer No known data sources ODBC dbi:ODBC:dBASE Files dbi:ODBC:Excel Files dbi:ODBC:MS Access Database Pg No known data sources Proxy Error: install_driver(Proxy) failed: Can't locate RPC/PlClient +.pm i SQLite No known data sources Sponge No known data sources mysql No known data sources Press any key to continue . . .
And the mysql> show databases; on the same machine shows this:
mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | test | +--------------------+ 4 rows in set (0.00 sec)
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: DBD mysql can't detect mysql installation
by moritz (Cardinal) on Jul 06, 2012 at 09:42 UTC | |
by mje (Curate) on Jul 09, 2012 at 08:45 UTC | |
by nitin1704 (Sexton) on Jul 09, 2012 at 05:55 UTC | |
by moritz (Cardinal) on Jul 09, 2012 at 06:29 UTC |
Back to
Seekers of Perl Wisdom