Re: Access denied in remote mysql connection
- From: Tim Greer <tim@xxxxxxxxxxxxx>
- Date: Thu, 05 Mar 2009 15:53:15 -0800
wes.tibular@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.
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 }
);
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?
<Also, please don't quote signatures, especially below your own text and
at the end of the post>
--
Tim Greer, CEO/Founder/CTO, BurlyHost.com, Inc.
Shared Hosting, Reseller Hosting, Dedicated & Semi-Dedicated servers
and Custom Hosting. 24/7 support, 30 day guarantee, secure servers.
Industry's most experienced staff! -- Web Hosting With Muscle!
.
- Follow-Ups:
- Re: Access denied in remote mysql connection
- From: wes . tibular
- 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
- Access denied in remote mysql connection
- Prev by Date: Re: "system" with [ ] in filename
- 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
|