friends, I wish to connect to a mySql database on a Linux machine from a windows machine ( win2003 server ) but 1st i wish to connect from a win XP ( my devel sys ) actually my real goal is to get values from a db and use them with imagemagik to make a pdf ... but 1st I need to connect to the MySql server ... then i suppose i will attempt a query ... then I suppose i will attempt to use those values in imagemagik so- how to connect to the sever on my XP sytem i have installed DBI
my 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;
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 OK
when 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 ?
Thnaks much

In reply to how to connect to a mySql database by zimbot

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.