C
chriswaltham
I'm trying to port a web-based application from a Solaris 2.6 box to
Mac OS X Server 10.4.8. The Solaris box was running perl 5.6.1 and
MySQL 4.0.18, the OS X box is running perl 5.6.2 and MySQL 4.0.18. Both
are running Net::MySQL 0.009. The trouble is, the Solaris box will
connect successfully to the MySQL DB but the OS X box will not.
FYI, I installed perl-5.6.2 on OS X in /usr/local/perl in order to
preserve the install that comes with the OS itself.
This is the code:
#!/usr/bin/perl -w
use Net::MySQL;
my $mysql = Net::MySQL->new(
database => 'mysql',
user => 'root',
password => 'secret'
);
# SLECT example
$mysql->query(q{SELECT * FROM user});
my $record_set = $mysql->create_record_iterator;
while (my $record = $record_set->each) {
printf "First column: %s Next column: %s\n",
$record->[0], $record->[1];
}
$mysql->close;
And this is the error it yields:
[root@csc-web2 admin]# perl test.pl
Access denied for user: '@localhost' to database '!' at test.pl line 5
I am pretty new to perl, so I'm not quite sure how to debug this. The
username and password are definitely correct, but the most troubling
thing is that the error message says that the perl file is trying to
connect to the database named '!', not the database named 'mysql'.
Anyone have any ideas on how I can debug this?
Thanks,
Chris
Mac OS X Server 10.4.8. The Solaris box was running perl 5.6.1 and
MySQL 4.0.18, the OS X box is running perl 5.6.2 and MySQL 4.0.18. Both
are running Net::MySQL 0.009. The trouble is, the Solaris box will
connect successfully to the MySQL DB but the OS X box will not.
FYI, I installed perl-5.6.2 on OS X in /usr/local/perl in order to
preserve the install that comes with the OS itself.
This is the code:
#!/usr/bin/perl -w
use Net::MySQL;
my $mysql = Net::MySQL->new(
database => 'mysql',
user => 'root',
password => 'secret'
);
# SLECT example
$mysql->query(q{SELECT * FROM user});
my $record_set = $mysql->create_record_iterator;
while (my $record = $record_set->each) {
printf "First column: %s Next column: %s\n",
$record->[0], $record->[1];
}
$mysql->close;
And this is the error it yields:
[root@csc-web2 admin]# perl test.pl
Access denied for user: '@localhost' to database '!' at test.pl line 5
I am pretty new to perl, so I'm not quite sure how to debug this. The
username and password are definitely correct, but the most troubling
thing is that the error message says that the perl file is trying to
connect to the database named '!', not the database named 'mysql'.
Anyone have any ideas on how I can debug this?
Thanks,
Chris