Page 1 of 1

Client authorization problem with MySQL 5.5 upgrade

Posted: Sat Nov 26, 2011 3:00 pm
by meyerbo2
Hi,
I am using Perl's DBI library to perform database calls within our Perl CGI scripts. When I call the Perl scripts directly from a Shell, they run fine against the new MySQL5.5 database, but when they get invoked through CGI from the web server, I get the following error:
Can't connect to database: Client does not support authentication protocol requested by server; consider upgrading MySQL client.

Searching the web, this indicates that the client making the call doesn't support MySQL 5.5's new password hashing algorithm.

Does anyone know how to solve this problem?

My script looks like this:

Code: Select all

#!/usr/local/bin/perl
use DBI;
#definition of variables
$db="meyerbo2_cs5";
$host="meyerbo2-cs5.db.sonic.net";
$user="meyerbo2_cs5-rw";
$password="XXXXXXXX";  # the root password
$numArgs = $#ARGV + 1;
$rv = 1;

if ($numArgs >= 2)
{
  #connect to MySQL database
  my $dbh   = DBI->connect ("DBI:mysql:database=$db:host=$host",
                           $user,
                           $password)
                           or print "Can't connect to database: $DBI::errstr\n";

  my $arg1_data = $dbh->quote($ARGV[1]);

  #prepare the query
  my $sth = $dbh->prepare( "
              SELECT cust_data
              FROM meyerbosdb
              WHERE cust_id=$arg1_data");

  #execute the query
  $sth->execute( );
  ## Retrieve the results of a row of data and print
  if ( my @row = $sth->fetchrow_array( ) )  {
         print "@row\n";
         $rv = 0;
  }
  if ( $sth->err( ) )
  {
    warn "Problem in retrieving results", $sth->errstr( ), "\n";
  }
  $sth->finish( );
  $dbh->disconnect or warn "Disconnection error: $DBI::errstr\n";
}
exit $rv;
Thanks,
Marcus

Re: Client authorization problem with MySQL 5.5 upgrade

Posted: Mon Nov 28, 2011 1:05 pm
by kgc
Marcus, we're working on upgrading the perl mysql modules now.

Re: Client authorization problem with MySQL 5.5 upgrade

Posted: Tue Nov 29, 2011 11:04 am
by williamt
Marcus, could you try now?


Thanks,
William

Re: Client authorization problem with MySQL 5.5 upgrade

Posted: Tue Nov 29, 2011 9:53 pm
by meyerbo2
Thanks for helping out with this. The calls work great from our main account now, but are still broken on ssl.sonic.net. Can you update the perl mysql modules on that machine also?

Re: Client authorization problem with MySQL 5.5 upgrade

Posted: Tue Nov 29, 2011 10:09 pm
by williamt
Sorry about that meant to fix that box too today.
It should all be working for you now.

Re: Client authorization problem with MySQL 5.5 upgrade

Posted: Thu Dec 01, 2011 8:55 pm
by meyerbo2
Thanks. Things seem to be working great. I plan to do a full migration this weekend. We appreciate your effort.