Re: Access denied in remote mysql connection



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.

.



Relevant Pages

  • script help to update member profiles
    ... form is all stored in a MySql Database (First Name, Last Name, Username, ... my partner that did all the perl scripts was injured ... Compare entered username and password to database to confirm the user is ...
    (comp.lang.perl.misc)
  • Re: allowing users to log into my website
    ... I have already created the backend using a MySQL ... database. ... The part that I'm hung up on is being able to pass the ... username from one page to the next. ...
    (comp.lang.php)
  • allowing users to log into my website
    ... I have already created the backend using a MySQL ... database. ... username from one page to the next. ... I'm running Apache 2 and PHP ...
    (comp.lang.php)
  • Re: Testing mysql query
    ... I am attempting to write information to a Mysql table called Jabber. ... can connect successfully, query data, and write data pretty much ... /* Searching for username in Authreg database and assiging it to ... And it errorr out telling me to, "Please select a unique username" as ...
    (comp.lang.php)
  • Re: MySQL Database problem (probably already solved in a message, but this is somewhat urgent)
    ... MySQL server has a database with a table, ... columns, an FSR column, and a password column. ... checked if the supposed arrays that were returned were actually arrays ...
    (comp.lang.php)