Re: Access denied in remote mysql connection
- From: wes.tibular@xxxxxxxxx
- Date: Thu, 5 Mar 2009 18:12:28 -0800 (PST)
On Mar 5, 3:53 pm, Tim Greer <t...@xxxxxxxxxxxxx> wrote:
wes.tibu...@xxxxxxxxx wrote:
On Mar 5, 12:57 pm, Tim Greer <t...@xxxxxxxxxxxxx> wrote:
wes.tibu...@xxxxxxxxx wrote:
Forgive me if this is not the appropriate forum for this question.
I have installed DBI, and DBD::mysqlpp (couln't get DBD::mysql to
compile) on my system (with the requisite Net::MySql). When i
connect to my local mysql database, things are fine.
When i attempt to connect to a remote mysql database, i get:
DBI connect('database=ossinv;host=remotehost','username',...)
failed: Access denied for user: '@localhost' (Using password: NO)
at /usr/
That seems to indicate there was no username passed. Also, it says
"localhost", yet you said this fails when you try to connect
remotely. Localhost is local (not remote), so your problem and
question are confusing.
@localhost is a redacted host name. it is what the remote connection
is returning in the error message
Be sure to paste the actual error message, or are you saying this very
literally was, showing @localhost with no username? That just doesn't
seem right is all.
Thank you for your patience. I have to redact certain information,
but probably should have used '@example.com' instead of '@localhost'
to avoid misinterpretation.
That said, yes, the actual error message said "Access denied for user:
'@example.com' " with no username. It appears that something between
the sample program and the network scrubbed the username and
password. I verified it was getting as far as into Net::Mysql, but
could not follow past that.
And, yes, that doesn't seem right to me either.
Anyway, if the script connects fine locally, then it's
simply a matter of passing the right, existing host and database
names and login credentials, which probably isn't a Perl related
question.
It's a question about what the perl modules DBD::mysqlpp and
Net::Mysql are doing that leads it to not pass what i give them. In
the code, the username and password are being passed to mysqlpp, and i
have verified that Net:Mysql gets them, I have no control over what
happens from there, but it seems that the module is dropping it. Was
hoping to hear from someone using these modules that has seen the
problem before and can clue me in.
Thanks for the response.
Try using RaiseError, such as:
my $dbh = DBI->connect("dbi:mysqlPP:database=$db;host=$host",
$user, $password, { RaiseError => 1 }
);
Sadly, this did not provide any different result than previous
attemtps without RaiseError
That example, such as the one you posted as trying, seems to be correct.
If you can connect using mysql on the command line, then it should
work, provided it uses the default port (3306), if it's something else,
just pass the port= value.
Examples from the docs:
my $dsn = "dbi:mysqlPP:$database";
my $dsn = "dbi:mysqlPP:database=$database;host=$hostname";
my $dsn = "dbi:mysqlPP:database=$database;host=$hostname;port=$port";
my $dbh = DBI->connect($dsn, $user, $password);
So:
my $dbh = DBI->connect($dsn, $user, $password, { RaiseError => 1 });
Just to confirm, you can definitely connect from the command line with:
mysql -hHOST -uUSER database -pPASSWORD
from that system to the remote server?
Yes. I can confirm that.
Thanks Tim. I will keep working on it.
.
- Follow-Ups:
- Re: Access denied in remote mysql connection
- From: Xho Jingleheimerschmidt
- Re: Access denied in remote mysql connection
- References:
- Access denied in remote mysql connection
- From: wes . tibular
- Re: Access denied in remote mysql connection
- From: Tim Greer
- Re: Access denied in remote mysql connection
- From: wes . tibular
- Re: Access denied in remote mysql connection
- From: Tim Greer
- Access denied in remote mysql connection
- Prev by Date: FAQ 8.20 How can I call my system's unique C functions from Perl?
- Next by Date: Re: Strange system() slowdown when using Inline::C
- Previous by thread: Re: Access denied in remote mysql connection
- Next by thread: Re: Access denied in remote mysql connection
- Index(es):
Relevant Pages
|