This is well outlined in the DBI perldoc btw ;-)


Andy Sharp wrote:
> 
> The syntax for connecting to a mysql database from perl/DBI is
> 
> my $dbh =
> DBI->connect('dbi:<drivername>:<database>:<host>','<username>','<passwor
> d>');
> 
> If host is ommitted, it presumes localhost.
> 
> Eg: $dbh =
> DBI->connect('dbi:mysql:testDB:dbserv','$username','$password');
> 
> There are more options see perldoc DBI and perldoc DBD::mysql
> 
> --A
> 
> >> This is what I have derived from O'Reilly books, though they make the
> 
> >> assumption that you are running the script from the same server as
> the
> >> database: $dbh = DBI->connect("dbi:mysql:table1", "$host", "$user",
> >> "$password") or die "Unable to connect";
> >> # table1 is the name of database.
> 
> > I believe it's pretty safe to say that the $host variable in that
> > statement is the IP of  the server you're trying to connect to.  I
> > can't test this, however, since the databases I have access to are
> > all restricted to localhost access...
> 
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
> 
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail <[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to