I am trying to connect to a mysql database an for some reason, the
username disappears from the DBI->connect call when MySQL gets the
connection attempt.

 

My perl code looks like

 

my $server = 'localhost';       # the database server is the same
machine as the web server.

my $db = 'error_code_db2';

my $db_username = 'webserver';       # username to get into the database

my $db_password = '';   # no password yet - I may regret that later

...

$dbh = DBI->connect("dbi:mysql:$db:$server", $db_username, $db_password
);

 

The error message I get in /var/log/httpd/error_log is:

 

DBI connect('error_code_db2:localhost','webserver',...) failed: Access
denied for user ''@'localhost' to database 'error_code_db2' at
/var/www/perl/ecdb.pl line 50

 

So obviously, the username has disappeared.  Why?

 

I tried connecting to the database using the command line and I get a
similar phenomena:

 

 

[EMAIL PROTECTED] perl]$ mysql -u webserver

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 26 to server version: 5.0.22

 

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

 

mysql> use error_code_db2;

ERROR 1044 (42000): Access denied for user ''@'localhost' to database
'error_code_db2'

mysql>

 

Again, the username has disappeared.

 

What is frustrating about this problem is that the software works on
another machine just fine.  I've granted user webserver access to the
appropriate tables in database error_code_db2 and I get the sense from
the error message that MySQL isn't complaining about access to a table,
but rather access to a database.

 

Thank you

 

Jeff Silverman  |  Network Support Engineer 

F5 Networks 

  P  888-882-4447

 F 206.272-5541

www.f5.com <http://www.f5.com>  

  D 206.272.6465

 M 

 

 

<<image001.gif>>

Reply via email to