I'm just getting into this myself so I could be totally wrong but it looks like your "access denied" message is because you are not supplying a password during the test.
duckyd mentioned the test doesn't use a password. Your select statement which displays root accounts shows root@localhost has a password assigned. I'm guessing this is the case with your second perl program. Maybe I'm not seeing it but I get the impression you need to supply a password there too.
Here is what I found on cpan.org about connecting with dbi.
$dbh = DBI->connect($dsn, $user, $password,
{ RaiseError => 1, AutoCommit => 0 });
Try adding that to your connect statement and see if it works. Also, check cpan. You might find what you are looking for here
DBI
If none of this works and if you are brave, you could always setup an account without a password and use that for your test. Better safe than sorry I'd say so try to incorporate the password :-)
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.