LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-30-2007, 03:12 AM   #1
kshkid
Member
 
Registered: Dec 2005
Distribution: RHEL3, FC3
Posts: 383

Rep: Reputation: 30
Mysql problem


Hi,

Am using mysql version 14.12
Code:
#! /opt/third-party/bin/perl
   
   use DBI;
   
   my $dsn = "DBI:mysql:database=mydb;" . "mysql_read_default_file=/home/work/db/my.cnf";
   my $username = "user";
   my $password = "user";
  
     
   my $dbh = DBI->connect($dsn, $username, $password) || die "Unable to acquire dB Handle:$DBI::errstr\n";
   
   
   $dbh->disconnect();
   
   exit 0
Code:
Error:

Unable to acquire dB Handle:Client does not support authentication protocol requested by server; consider upgrading MySQL client

I tried to specify only the socket file and not the my.cnf file
Code:
#! /opt/third-party/bin/perl
   
   use DBI;
   
   my $dsn = "DBI:mysql:database=mydb;socket=/home/work/db/mysql.sock";
   my $username = "user";
   my $password = "user";
  
     
   my $dbh = DBI->connect($dsn, $username, $password) || die "Unable to acquire dB Handle:$DBI::errstr\n";
   
   
   $dbh->disconnect();
   
   exit 0
Code:
Error:
Unable to acquire dB Handle:Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock'

Could you show some pointers, I tried searching in the forum but could not find anything related

Thanks
 
Old 03-30-2007, 04:20 AM   #2
Guttorm
Senior Member
 
Registered: Dec 2003
Location: Trondheim, Norway
Distribution: Debian and Ubuntu
Posts: 1,453

Rep: Reputation: 446Reputation: 446Reputation: 446Reputation: 446Reputation: 446
Hi

I've gotten this error message too - upgrading from 4.0 to 4.1. The problem is that the server is using a different password encryption and the client doesn't support it.

There are many ways to solve this, look at:
http://dev.mysql.com/doc/refman/5.1/en/old-client.html
 
Old 03-30-2007, 04:37 AM   #3
kshkid
Member
 
Registered: Dec 2005
Distribution: RHEL3, FC3
Posts: 383

Original Poster
Rep: Reputation: 30
Thanks for the reply

But why is there a different kind of error, when I do specify the socket file to be used than the default one? Isnt that the right way of specifying the socket file ?
 
Old 03-30-2007, 04:41 AM   #4
kshkid
Member
 
Registered: Dec 2005
Distribution: RHEL3, FC3
Posts: 383

Original Poster
Rep: Reputation: 30
Adding to the point,

I have this kind of error only when I try to connect and access the data through perl code.

Everything seems to be fine when running through command line and there is no such error reported!

Could there be a problem with the perl code ?
 
Old 03-30-2007, 08:24 AM   #5
Guttorm
Senior Member
 
Registered: Dec 2003
Location: Trondheim, Norway
Distribution: Debian and Ubuntu
Posts: 1,453

Rep: Reputation: 446Reputation: 446Reputation: 446Reputation: 446Reputation: 446
Hi again.

I think the Perl code has nothing to do with it. The problem is the version of the mysql client library that Perl uses. The page I mentioned has different solutions.

Why the socket example doesn't work is not very clear. The command mysqladmin will show you the socket that mysql uses. You will have to specify the same socket on the server and on the client.
 
Old 03-30-2007, 01:00 PM   #6
kshkid
Member
 
Registered: Dec 2005
Distribution: RHEL3, FC3
Posts: 383

Original Poster
Rep: Reputation: 30
It worked !

problem seems to be in the version of perl

with perl version 5.8.0 it didnt work

with perl version 5.6.1 it worked


i need to understand what made the difference !!

if that is the case, if the code is working only with a single version it would be really difficult to dig in to the problem!

Any reason what changing the version of perl made it to work ?

Thanks again!
 
Old 03-30-2007, 01:26 PM   #7
Guttorm
Senior Member
 
Registered: Dec 2003
Location: Trondheim, Norway
Distribution: Debian and Ubuntu
Posts: 1,453

Rep: Reputation: 446Reputation: 446Reputation: 446Reputation: 446Reputation: 446
Well, it's explained on that link I posted.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Bugzilla - MySQL - perl - DBD::mysql install problem amchargue Linux - Software 3 09-10-2008 12:01 AM
Bugzilla - MySQL - perl - DBD::mysql install problem Runningonair Linux - Software 8 10-12-2007 12:42 AM
mysql error Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. Dannux Linux - Software 3 03-24-2006 08:44 AM
php-mysql dependancy problem after nitemare mysql upgrade. RHEL4 andrewc Red Hat 1 01-03-2006 04:16 PM
MySQL server problem after linking (mysql.sock) ewijaya Linux - General 4 01-19-2004 09:46 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:03 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration