Socket problems

Greetings

I am trying to install DBD::mysql on a quad dual-core Xeon system running RedHat Enterprise v4. I just
installed mysql 5.0.21 from source and it passes all the self tests. I have installed DBI-1.5 and it passes
all the tests. I can compile DBD::mysql (v 3.0002) but the test fails:

t/mysql2.............Mysql connect('database=test;host=','',...) failed: Can't connect to local
MySQL server through socket '/var/lib/mysql/mysql.sock' (2) at t/mysql2.t line 29

This is a puzzler, because the output from mysql_config is:

[root <at> HSV-PROBE DBD-mysql-3.0002]# mysql_config
Usage: /usr/local/mysql/bin/mysql_config [OPTIONS]
Options:
        --cflags         [-I/usr/local/mysql/include/mysql]
        --include        [-I/usr/local/mysql/include/mysql]
        --libs           [-L/usr/local/mysql/lib/mysql -lmysqlclient -lz -lcrypt -lnsl -lm]
        --libs_r         [-L/usr/local/mysql/lib/mysql -lmysqlclient_r -lz -lpthread -lcrypt -lnsl -lm -lpthread]
        --socket         [/tmp/mysql.sock]
        --port           [3306]
        --version        [5.0.21]
        --libmysqld-libs [-L/usr/local/mysql/lib/mysql -lmysqld -lz -lpthread -lcrypt -lnsl -lm -lpthread -lrt]

/etc/my.cnf also points to /tmp/mysql.sock.

I tried hardwiring the socket in the make with perl Makefile.PL --testsocket=/tmp/mysql.sock and the
tests _still_ try to use /var/lib/mysql/mysql.sock.

Does anybody have any ideas why DBD::mysql is so fixated on the wrong socket path?

(Continue reading)

Arthur H Wakida | 3 May 2006 21:29

Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13)

OS RH Enterprise V4 (kernel 2.5.9-5.EL), Perl 5.8.5, DBI-1.46, DBD-MySQL-2.9004-3.1, MySQL 4.1.7
installed 

I can access/update MySQL db via webmin (port 10000) and SQLyog (port 3306) without any problem.

When I try to connect to MySQL db via ; 
     my $hndl = DBI->connect("DBI:mysql:$database", $user, $password) or db_err("Unable to contect to
$database", $DBI::errstr);

I get the following message : "Can't connect to local MySQL server through socket
'/var/lib/mysql/mysql.sock' (13)"

Socket in question does exist in /var/lib/mysql and all directories involved is completely open (777). 
I've other servers up 
and running without any problem (albeit different versions).  Did I miss something?  Any help/ideas is
greatly appreciated! 

Arthur
Mike Blezien | 3 May 2006 21:44

Re: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13)

Arthur,

the Error 13 means Permission Denied. check the ownership of the sock file, is 
should be owned by the "mysql" user if owned by 'root', then this maybe causing 
your problems.

Mike
----- Original Message ----- 
From: "Arthur H Wakida" <ahwakida <at> yamada.com>
To: <perl <at> lists.mysql.com>
Sent: Wednesday, May 03, 2006 2:29 PM
Subject: Can't connect to local MySQL server through socket 
'/var/lib/mysql/mysql.sock' (13)

OS RH Enterprise V4 (kernel 2.5.9-5.EL), Perl 5.8.5, DBI-1.46, 
DBD-MySQL-2.9004-3.1, MySQL 4.1.7 installed

I can access/update MySQL db via webmin (port 10000) and SQLyog (port 3306) 
without any problem.

When I try to connect to MySQL db via ;
     my $hndl = DBI->connect("DBI:mysql:$database", $user, $password) or 
db_err("Unable to contect to $database", $DBI::errstr);

I get the following message : "Can't connect to local MySQL server through 
socket '/var/lib/mysql/mysql.sock' (13)"

Socket in question does exist in /var/lib/mysql and all directories involved is 
completely open (777).  I've other servers up
and running without any problem (albeit different versions).  Did I miss 
(Continue reading)

Arthur H Wakida | 3 May 2006 22:51

Re: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13)

Mike,

Thank you very much for your quick response.
Unfortunately, mysql.sock is owned by mysql and on top of that I have
it opened for all (rwx).  One more info, in messages log I see following
error : ... denied {connectto } for pid=7678 exe=/usr/bin/perl 
path=/var/lib/mysql/mysql.sock
              scontext=root:system_r:httpd_sys_script_t 
tcontext=root:system_r:unconfied_t tclass=
              unix_stream_socket
My data directory and /var/lib/mysql/mysql.sock is both owned by mysql. 
Firewall is completely
disabled (lokkit). I don't know what else maybe blocking this connection.

Arthur

> Arthur,
>
> the Error 13 means Permission Denied. check the ownership of the sock 
> file, is should be owned by the "mysql" user if owned by 'root', then this 
> maybe causing your problems.
>
> Mike
> ----- Original Message ----- 
> From: "Arthur H Wakida" <ahwakida <at> yamada.com>
> To: <perl <at> lists.mysql.com>
> Sent: Wednesday, May 03, 2006 2:29 PM
> Subject: Can't connect to local MySQL server through socket 
> '/var/lib/mysql/mysql.sock' (13)
>
(Continue reading)

Mike Blezien | 3 May 2006 23:06

Re: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13)

Arthur,
----- Original Message ----- 
From: "Arthur H Wakida" <ahwakida <at> yamada.com>
To: "Mike Blezien" <mickalo <at> frontiernet.net>; <perl <at> lists.mysql.com>
Sent: Wednesday, May 03, 2006 3:51 PM
Subject: Re: Can't connect to local MySQL server through socket 
'/var/lib/mysql/mysql.sock' (13)

> Mike,
>
> Thank you very much for your quick response.
> Unfortunately, mysql.sock is owned by mysql and on top of that I have
> it opened for all (rwx).  One more info, in messages log I see following
> error : ... denied {connectto } for pid=7678 exe=/usr/bin/perl 
> path=/var/lib/mysql/mysql.sock
>              scontext=root:system_r:httpd_sys_script_t 
> tcontext=root:system_r:unconfied_t tclass=
>              unix_stream_socket
> My data directory and /var/lib/mysql/mysql.sock is both owned by mysql. 
> Firewall is completely
> disabled (lokkit). I don't know what else maybe blocking this connection.
>
> Arthur

is the entire mysql folder and database folders owned by 'mysql.mysql' ??

Mike

>> Arthur,
>>
(Continue reading)

Arthur H Wakida | 3 May 2006 23:15

Re: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13)

Mike,

Yes, mysql:mysql plus just for the heck of it 'rwx' for all.

Arthur

> Arthur,
> ----- Original Message ----- 
> From: "Arthur H Wakida" <ahwakida <at> yamada.com>
> To: "Mike Blezien" <mickalo <at> frontiernet.net>; <perl <at> lists.mysql.com>
> Sent: Wednesday, May 03, 2006 3:51 PM
> Subject: Re: Can't connect to local MySQL server through socket 
> '/var/lib/mysql/mysql.sock' (13)
>
>
>> Mike,
>>
>> Thank you very much for your quick response.
>> Unfortunately, mysql.sock is owned by mysql and on top of that I have
>> it opened for all (rwx).  One more info, in messages log I see following
>> error : ... denied {connectto } for pid=7678 exe=/usr/bin/perl 
>> path=/var/lib/mysql/mysql.sock
>>              scontext=root:system_r:httpd_sys_script_t 
>> tcontext=root:system_r:unconfied_t tclass=
>>              unix_stream_socket
>> My data directory and /var/lib/mysql/mysql.sock is both owned by mysql. 
>> Firewall is completely
>> disabled (lokkit). I don't know what else maybe blocking this connection.
>>
>> Arthur
(Continue reading)

Vladimir V. Kolpakov | 3 May 2006 23:47

Re: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13)

Arthur, --

Could disabled SELinux work for you?
  (/usr/sbin/setenforce Permissive)

Details:
  http://bugs.mysql.com/bug.php?id=12676

--w

On Wed, May 03, 2006 at 02:15:38PM -0700, Arthur H Wakida wrote:
> Mike,
> 
> Yes, mysql:mysql plus just for the heck of it 'rwx' for all.
> 
> Arthur
> 
> >Arthur,
> >----- Original Message ----- 
> >From: "Arthur H Wakida" <ahwakida <at> yamada.com>
> >To: "Mike Blezien" <mickalo <at> frontiernet.net>; <perl <at> lists.mysql.com>
> >Sent: Wednesday, May 03, 2006 3:51 PM
> >Subject: Re: Can't connect to local MySQL server through socket 
> >'/var/lib/mysql/mysql.sock' (13)
> >
> >
> >>Mike,
> >>
> >>Thank you very much for your quick response.
> >>Unfortunately, mysql.sock is owned by mysql and on top of that I have
(Continue reading)

Marco Wise | 4 May 2006 00:08
Picon
Favicon
Gravatar

Re: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13)

You may also want to take a look at the following fixes for the  
SELinux policy:

https://rhn.redhat.com/errata/RHBA-2005-251.html (it lists what looks  
like your problem) and the update that supercedes it:
https://rhn.redhat.com/errata/RHBA-2006-0049.html

Good luck!

- marco

On May 3, 2006, at 2:47 PM, Vladimir V. Kolpakov wrote:

> Arthur, --
>
> Could disabled SELinux work for you?
>   (/usr/sbin/setenforce Permissive)
>
> Details:
>   http://bugs.mysql.com/bug.php?id=12676
>
> --w
>
>
> On Wed, May 03, 2006 at 02:15:38PM -0700, Arthur H Wakida wrote:
>> Mike,
>>
>> Yes, mysql:mysql plus just for the heck of it 'rwx' for all.
>>
>> Arthur
(Continue reading)

Arthur H Wakida | 4 May 2006 00:19

Re: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13)

Valdimir!,

That's it!  Thank you all soooo much!
Mike, Vladamir, Marco your efforts just saved my
sanity (of what I have remaining)!  Thanks again.

Arthur

----- Original Message ----- 
From: "Vladimir V. Kolpakov" <w <at> sfgate.com>
To: <perl <at> lists.mysql.com>
Sent: Wednesday, May 03, 2006 2:47 PM
Subject: Re: Can't connect to local MySQL server through socket 
'/var/lib/mysql/mysql.sock' (13)

> Arthur, --
>
> Could disabled SELinux work for you?
>  (/usr/sbin/setenforce Permissive)
>
> Details:
>  http://bugs.mysql.com/bug.php?id=12676
>
> --w
>
>
> On Wed, May 03, 2006 at 02:15:38PM -0700, Arthur H Wakida wrote:
>> Mike,
>>
>> Yes, mysql:mysql plus just for the heck of it 'rwx' for all.
(Continue reading)

Drew Schulz | 10 May 2006 22:42

MySQL 4.1 => 5.0.18 Migration issue

We have an application that is hit by 5+ million requests a day. 

In production we have MySQL 4.1 with DBD::mysql 2.9.003.  We're running
apache with mod_perl.

We've set up a library that keeps all the prepared sql statements that can
be executed in the script (about 10).  We need the application to run as
fast as it possibly can.  Currently it runs within 6 milliseconds.
Performance is very important to us.

The application references the prepared statements (as globals) to execute
the statement.  All of the database access is handled in one library
function.  The prepared statements are set up as global shared variables to
that library function.

This all works great with 4.1 and DBD::mysql 2.9.003

We are testing MySQL 5.0.18 and DBD::mysql 3.0002, and it doesn't seem to
work in a multi user environment.  It works fine when the website is
sequentially hit, but when more than one process is hitting the box, after
about 75-100 concurrent hits, things start breaking down.   

The most common message is "Commands out of sync;  you can't run this
command now"  I also see "Unknown prepared statement handler (XXXX) given to
mysql_stmt_execute at .

I'm fetching all the values from the statement handler using while
(sth->fetch_row_array), so I don't think it's a mysql_store_result issue,
but I don't know.

(Continue reading)


Gmane