Seen this message? Can't connect to local MySQL server through socket '/tmp/mysql.sock'

Seen this message? Can't connect to local MySQL server through socket '/tmp/mysql.sock'

Post by arm » Mon, 26 Jan 2004 07:13:30


Seen this message? Can't connect to local MySQL server through socket
'/tmp/mysql.sock'

I got this trying to install DBI and DBD for mysql from CPAN. After
fumbling, a comment by somebody said "Make /tmp world writable and set
the sticky bit"

OK
so

chmod uog+t /tmp (and I did +rwx too - was that wrong?)

but no dice, so knowing that mysql has set up its socket in
/var/lib/mysql/mysql.sock and finding no obvious way to change this
default, I used a soft link

in /tmp

ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock

and now everything works right. But, have I compromised file
permissions unnecessarily, or, is there a way to just use
/var/lib/mysql/mysql.sock without this fussing?

Thanks!
 
 
 

Seen this message? Can't connect to local MySQL server through socket '/tmp/mysql.sock'

Post by Gunnar Hja » Mon, 26 Jan 2004 07:55:07


I just saw it in another newsgroup. Don't multi-post!

--
Gunnar Hjalmarsson
Email: http://www.yqcomputer.com/

 
 
 

Seen this message? Can't connect to local MySQL server through socket '/tmp/mysql.sock'

Post by Dan » Wed, 28 Jan 2004 11:49:11


Yes, You can specify an option to use a particular socket file in your
DSN when establishing your connection in perl. FYI when you get around
to configuring your PHP install you'll need to look up that option too.
I've used it before but don't remember the syntax off hand.

This is courtesy of a google search on |DBI Mysql sock file|

my $dbh = DBI->connect("DATABASE;mysql_socket=/PATH/TO/SOCKET", "user",
"pass", "mysql");

Although the order presented here looks wrong, I'd try this, then put
the ";mysql_socket=" at the end with your actual path following it.