in reply to DBD::msyql tests

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 :-)