MySQL Forums
Forum List  »  Perl

DBI connect error
Posted by: Daniel Diaz
Date: June 02, 2006 12:50AM

Hi,

I have a MySQL server 4.1 running on Win XP. I have connected to it with no problem. Now, I am trying to connect to a remote server using the following code snippet. The error message that I get is confusing:

Why is it trying to connect to localhost when I specify my remote server?

$ perl test.pl
DBI connect('database=db_name; host=my_remote_host; port=3306','user_name',...) failed: Access denied for user 'user_name'@'localhost' (using password: YES) at test.pl line 43

use DBI;
use DBD::mysql;
use DateTime;

my $DSN = "DBI:mysql:database=db_name; host=my_remote_host; port=3306";

$dbh = &connect_db;

sub connect_db
{
my $dbh = DBI->connect($DSN, $user, $password, {RaiseError => 1})
or die "Connection failure";

return $dbh;
}

Thanks.

Options: ReplyQuote


Subject
Written By
Posted
DBI connect error
June 02, 2006 12:50AM
June 02, 2006 01:09AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.