Hi, I have a problem accessing MySQL database. I have a database changes_db
and when I access it with mysql -h jon -u join -p changes_db, I have no
problems. But if I use Perl script to access same database I get:

DBI->connect(database=changes;host=jon;port=) failed:
Access denied for user: 'join@jon' to database 'changes_db' at
./test_db.cgi line 15

The script is following:

#!/usr/bin/perl -w
use strict;                      # enforce declarations and quoting
use DBI;
use CGI qw(:all);                # import shortcuts
$| = 1;                          # disable buffering

my $username = "join";
my $password = "equant";
my $database = "chances_db";
my $driver   = "mysql";
my $port     = '';
my $hostname = "jon";

my $dsn = "DBI:$driver:database=$database;host=$hostname;port=$port";
my $dbh = DBI->connect($dsn, $username, $password);

if ($dbh) {
    print $DBI::errstr;
    exit 1;
}

Regards
Jon Ingason
Sr Field Ops Eng
IP/Router Operation
Global One Services AB trading as Equant
Solna strandväg 82
PO BOX 1
171 18 SOLNA
SWEDEN
--------------------------------
Work:     +46 8 5191 3316
Fax:      +46 8 5191 3200
Cellular: +46 708 91 3316
E-mail:   [EMAIL PROTECTED]
--------------------------------


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to