zimbot has asked for the wisdom of the Perl Monks concerning the following question:
so i have obscured the server addrss is this 'form" right 'mysql.208.233.55.555:3306'; with the ip num being 208.233.55.555 ( yes - that's not the num ) and port 3306 and I do not have a password so I am thinking my $password = ''; would be OKmy current perl #!C:\perl\bin\perl use warnings; use strict; use DBI; my $hostname = 'mysql.208.233.55.555:3306'; my $database = 'actaulDBNotGiven'; my $user = 'ActualNameNotGiven'; my $password = ''; my $driver = 'mysql'; my $dsn = "DBI:$driver:database=$database;host=$hostname"; my $dbh = DBI->connect($dsn, $user, $password) or die "Can't connect\n + $!\n"; print "$_\n" for $dbh->tables; $dbh->disconnect(); exit;
Thnaks muchwhen I run the above ( with the real addrss etc ) i get install_driver(mysql) failed: Can't locate DBD/mysql.pm in @INC (@INC +contains: C:/Perl/lib C:/Perl/site/lib .) at (eval 4) line 3. Perhaps the DBD::mysql perl module hasn't been fully installed, or perhaps the capitalisation of 'mysql' isn't right. Available drivers: DBM, ExampleP, File, Gofer, Proxy, Sponge. at D:\uofM\lable\cnt01.pl line 12 wher cnt01.pl is my file. I know the proper addrss , and usr & psswd and something -- i just did , and may have done wrong is this to insta +ll DBI ppm > install DBI >and i guess that worked cause i see a >Successfully installed DBI version 1.602 in ActivePerl 5.8.8.816. > >and i see where i can > install DBD-mysql > >but since the mysql is on a server do i need the >install DBD-mysql ?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: how to connect to a mySql database
by moritz (Cardinal) on Dec 02, 2008 at 22:13 UTC | |
|
Re: how to connect to a mySql database
by zentara (Cardinal) on Dec 03, 2008 at 17:58 UTC |