List:General Discussion« Previous MessageNext Message »
From:Sasha Pachev Date:July 21 1999 4:55pm
Subject:Re: HELP! Client Can't connect
View as plain text  
Chris Lambrou wrote:
> 
> Hello,
> 
> I know I am doing something wrong here, just can't figure it
> out.  I am using the following PERL code to connect to my local
> mysql server:
> 
> -------------------------
> print "Content-Type: text/html\n\n";
> use Mysql;
> $dbh = Mysql->Connect('localhost', 'z100' ,'Z100' ,'z100club+');
> 
> if (not $dbh)  {
>   print "Could Not connect to database.\n";
>   print "Reason: $Mysql::db_errstr";
> } else {
>   print "Connected";
> }
> 
> -------------------------
> This prints the following on the web page:
> 
> Could Not connect to database.
> Reason:
> 
> ( The $Mysql::db_errstr string is EMPTY!!! )
> 
> Notes:
> 1. MySql Version: 3.21.33b.
>    The server was started with a plain "mysqld" command
> 
> 2. I've manually added the above user, pass*d to the user and db tables.
>    From the command line, I can login using the above credentials
>    just fine.
> 
> 3. If I change the password to anything else in the PERL code
>    above, I get this in $Mysql::db_errstr:
>    "Access denied for user: 'Z100@localhost' (Using password: YES)"
>    Which is what it should be in the $Mysql::db_errstr.
> 
> Can someone please help?
> 
> Thanks.
> Chris.
> 

If you really have to use Mysql module, read the docs carefully on how
to check for errors - it appears to me that you actually connect, but
the condition not $dbh is true regardless. 

Or, better, use the DBI interface.

-- 
Sasha Pachev
http://www.sashanet.com/ (home)
http://www.direct1.com/ (work)
Thread
HELP! Client Can't connectChris Lambrou21 Jul
  • Re: HELP! Client Can't connectSasha Pachev21 Jul
  • Re: HELP! Client Can't connectMicheal Mc Evoy22 Jul