473,386 Members | 1,823 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

DBI and sockets

I'm looking for a better way to fix my problem.

I'm using Perl, DBI, DBD::mysql,
I was getting this error...
"Can't connect to local MySQL server through socket
'/var/lib/mysql/mysql.sock' (2)"

the default setting for looking for mysql.sock in either DBI or DBD is
/var/lib/mysql/mysql.sock
(at least on my install), yet the real location is /tmp/mysql.sock

I never had a problem until I tried a simple CGI program.

This fixed the problem by adding the mysql_socket attribute to my
connection...
$dbh =
DBI->connect("DBI:mysql:host=localhost:mysql_socket=/tmp/mysql.sock;database=business"...

Do you know of a way to avoid adding this attribute to my connection string?

Thanks,

Don

Jul 19 '05 #1
4 8727
Don Stefani wrote:
I'm looking for a better way to fix my problem.

I'm using Perl, DBI, DBD::mysql,
I was getting this error...
"Can't connect to local MySQL server through socket
'/var/lib/mysql/mysql.sock' (2)"

the default setting for looking for mysql.sock in either DBI or DBD is
/var/lib/mysql/mysql.sock
(at least on my install), yet the real location is /tmp/mysql.sock

I never had a problem until I tried a simple CGI program.

This fixed the problem by adding the mysql_socket attribute to my
connection...
$dbh =
DBI->connect("DBI:mysql:host=localhost:mysql_socket=/tmp/mysql.sock;database=business"...
Do you know of a way to avoid adding this attribute to my connection
string?

Thanks,

Don

I also added a ln -s from /tmp/mysql.sock to /var/lib/mysql/

But I'd sure like to fix this the right way..
Thanks,

Don

Jul 19 '05 #2
Don Stefani wrote:
I'm looking for a better way to fix my problem.

I'm using Perl, DBI, DBD::mysql,
I was getting this error...
"Can't connect to local MySQL server through socket
'/var/lib/mysql/mysql.sock' (2)"

the default setting for looking for mysql.sock in either DBI or DBD is
/var/lib/mysql/mysql.sock
(at least on my install), yet the real location is /tmp/mysql.sock

I never had a problem until I tried a simple CGI program.

This fixed the problem by adding the mysql_socket attribute to my
connection...
$dbh =
DBI->connect("DBI:mysql:host=localhost:mysql_socket=/tmp/mysql.sock;database=business"...
Do you know of a way to avoid adding this attribute to my connection
string?

Thanks,

Don

I also added a ln -s from /tmp/mysql.sock to /var/lib/mysql/

But I'd sure like to fix this the right way..
Thanks,

Don

Jul 19 '05 #3
Don Stefani wrote:
Don Stefani wrote:
I'm looking for a better way to fix my problem.

I'm using Perl, DBI, DBD::mysql,
I was getting this error...
"Can't connect to local MySQL server through socket
'/var/lib/mysql/mysql.sock' (2)"

the default setting for looking for mysql.sock in either DBI or DBD is
/var/lib/mysql/mysql.sock
(at least on my install), yet the real location is /tmp/mysql.sock

I never had a problem until I tried a simple CGI program.

This fixed the problem by adding the mysql_socket attribute to my
connection...
$dbh =
DBI->connect("DBI:mysql:host=localhost:mysql_socket=/tmp/mysql.sock;database=business"...
Do you know of a way to avoid adding this attribute to my connection
string?

Thanks,

Don

I also added a ln -s from /tmp/mysql.sock to /var/lib/mysql/

But I'd sure like to fix this the right way..
Thanks,

Don

OK, so I'm answering all of my own posts, sorry.

I reinstalled both DBI and DBD::mysql by hand.
I think I had used Yast (suse9) to install DBD originally.

After removing the sym-link everything works fine.
I guess I'll avoid the packages when it comes to Perl and MySQL.

Thanks, I hope this helps someone else.

Don

Jul 19 '05 #4
Don Stefani wrote:
Don Stefani wrote:
I'm looking for a better way to fix my problem.

I'm using Perl, DBI, DBD::mysql,
I was getting this error...
"Can't connect to local MySQL server through socket
'/var/lib/mysql/mysql.sock' (2)"

the default setting for looking for mysql.sock in either DBI or DBD is
/var/lib/mysql/mysql.sock
(at least on my install), yet the real location is /tmp/mysql.sock

I never had a problem until I tried a simple CGI program.

This fixed the problem by adding the mysql_socket attribute to my
connection...
$dbh =
DBI->connect("DBI:mysql:host=localhost:mysql_socket=/tmp/mysql.sock;database=business"...
Do you know of a way to avoid adding this attribute to my connection
string?

Thanks,

Don

I also added a ln -s from /tmp/mysql.sock to /var/lib/mysql/

But I'd sure like to fix this the right way..
Thanks,

Don

OK, so I'm answering all of my own posts, sorry.

I reinstalled both DBI and DBD::mysql by hand.
I think I had used Yast (suse9) to install DBD originally.

After removing the sym-link everything works fine.
I guess I'll avoid the packages when it comes to Perl and MySQL.

Thanks, I hope this helps someone else.

Don

Jul 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Tero Saarni | last post by:
Hi, I have several threads communicating with each other using events stored in Queues. Threads block on Queue.get() until somebody publishes an event in thread's event queue. I need to add...
1
by: Dmitry Akselrod | last post by:
Hello everyone, I have a vb.net application that wraps the TCPListener object in a class. The server connects to the local interface and establishes itself on port 9900. It then polls for...
0
by: mrpolitics | last post by:
So I'm working with PureIRCD (http://sourceforge.net/projects/pure-ircd) and everything was fine untill yesterday when the server crashed. So I did a cold restart and staretd the server back up...
3
by: Logan McKinley | last post by:
I have a C# program that uses blocking sockets and want to allow the user to stop the server. The problem I am having is the socket blocks on...
1
by: Adam Clauss | last post by:
I am (attempting) to move an existing socket application to use raw sockets. Right now, my application is essentially a port forwarder. Upon receiving a connection, it will open a connection to...
4
by: BadOmen | last post by:
Hi, What is the different between 'System.Net.Sockets.Socket' and 'System.Net.Sockets.TcpClient'? When do I use System.Net.Sockets.TcpClient and System.Net.Sockets.Socket?? Yours, Jonas
3
by: Michael Maercker | last post by:
hi! i'm really not into networking at all and have now been asigned the task of porting a vb6-code into vb.net (compact framework, in this case) and the code uses the winsock-control. i quickly...
3
by: J C | last post by:
Hi, I'm using UDPClient to make a simple DNS server. I notice that intermittently and unpredictibly I get: Unhandled Exception: System.Net.Sockets.SocketException: An existing connection...
7
by: Adam01 | last post by:
Im using cygwin to test the code of a server I am writing. I've included sys/types.h, sys/socket.h, netdb.h, and arpa/inet.h. And this is the output.. ../../../sockets.cpp: In constructor...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.