LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-09-2012, 01:23 AM   #1
Shahid nx
Member
 
Registered: Jan 2012
Posts: 46

Rep: Reputation: Disabled
fail to connect mysql using perl!!?


Hi Sir/friends,
i have written a perl program to do connectivity with mysql and for that we have to specify host name,database,user,password. but the problem is when i m giving localhost as a host name it is running fine and connecting to mysql. But when i m specifying ip address of server where mysql is running in place of localhost it is showing error that cant connect to mysql server something. Not getting what is the problem plz if any one knows the solution..???

Thanks

Regards.
SHAHID NX
 
Old 02-09-2012, 03:16 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
well can you connect to the remote mysql server outside of perl, using the mysql command itself? can you telnet to the mysql port, 3306, over the network?
 
Old 02-09-2012, 04:43 AM   #3
Shahid nx
Member
 
Registered: Jan 2012
Posts: 46

Original Poster
Rep: Reputation: Disabled
Question

Sir tried by changing user name and it is working but i wonder how it is happening because the process which i m trying to connect with mysql is running on 10.0.3.172 server and mysql is runnig on 10.0.3.144 . and the login name and password of 10.0.3.144 server is abc and abc respectively. and user name and password of mysql is abc and abc123 resp. So by seing this all to connect mysql i have to give hostname=10.0.3.144 user=abc and password=abc123. But when i give this it is not connecting. when i change password to abc(which is password of 10.0.3.144 server ) it is connecting. The overall i m trying to say is my process which is running on 10.0.3.172 is connecting to mysql using the 10.0.3.144 server user name and password instead of mysql user name and password.
 
Old 02-09-2012, 05:28 AM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,258

Rep: Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328
See the cmd line examples here http://dev.mysql.com/doc/refman/5.0/en/connecting.html.
This is what acid_kewpie is referring to.
Test the cxn just at the shell cmd line first, thus avoiding any errors there may be in your Perl.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Using Perl to connect to MySQL using webmin manoj1007 Linux - Newbie 6 09-02-2009 12:32 AM
Warning: mysql_connect() [function.mysql-connect]: Can't connect to local MySQL serve vinnyband Linux - Software 3 10-30-2008 03:53 PM
mysql error Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. SpellChainz Linux - Newbie 1 06-23-2007 04:35 PM
mysql error Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. Dannux Linux - Software 3 03-24-2006 09:44 AM


All times are GMT -5. The time now is 11:43 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration