Hello
I have installed NET::MySQL module and I am trying to connect to MySQL database and send a query. I am able to manually connect to MySQL DB with Details below however when I try to connect using the script below I get the following error;
Access denied for user: '@sb-desktop.local.server.com' (Using password: NO) at MySQL_queryDB.pl line 5
It seems as though the password is not being sent... any ideas how to resolve this.
thanks for your help in advance.
Mr P
## Perl script to log into Database and quesry Tables
use Net::MySQL;
my $mysql = Net::MySQL->new(
hostname => 'testscript',
database => 'test',
user => 'tester',
password => 'tester'
);
# SELECT example
$mysql->query(q{SELECT * FROM product_releases});
my $record_set = $mysql->create_record_iterator;
while (my $record = $record_set->each) {
printf "First column: %s Next column: %s\n",
$record->[0], $record->[1];
}
$mysql->close;
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.