Unable to connect to MySQL 5.7 with unix socket

Description

Connecting directly through mysql CLI with the same username, password, and socket parameter works without issue. However, when using xtrabackup, the following is returned:

Checking via strace -f -s 8192 looks fine until:

This seems to be suggesting connect is being fed invalid arguments, but as the arguments being sent work fine with the CLI client and appear to pass-through correctly into strace, I am opening this bug to investigate why connect is reporting EINVAL.

Environment

CentOS 7.6

MySQL 5.7.30

Attachments

1

Activity

Andrew Xavier 
January 15, 2021 at 12:51 AM

Hi Lalit, 

I was able to narrow down the issue to selinux in enforcing mode. You are unable to reproduce since I believe it's running on non selinux or permissive mode. But there is no denial errors.
ausearch -i -m avc -ts today
Please try the test with selinux in permissive and enforced mode.

Here is the simple script to test which is similar to xtrabackup calling perlDBI

#!/usr/bin/perl -w
use v5.10;
use DBI;
say "Perl MariaDB Connect Demo";
my $dsn = "DBI:mysql:database=andrewbackuptest;mysql_socket=/tmp/mysqld_andrewbackuptest_3510.sock ";
my $username = 'xaviea';
my $password = 'xaviea';

my %attr = ( PrintError=>0, RaiseError=>1);

my $dbh = DBI->connect($dsn,$username,$password, %attr);

say "Connected to the MySQL database.";

$dbh->disconnect();

[ tsa401:/root]# setenforce 0
[.tsa401:/root]# getenforce
Permissive

[ tsa401:/root]# perl dbconnect.pl
Perl MariaDB Connect Demo
Connected to the MySQL database.

------------------------

Next trying with Enforce mode

[ tsa401:/root]# getenforce
Enforcing

[ tsa401:/root]# perl dbconnect.pl
Perl MariaDB Connect Demo
DBI connect('database=andrewbackuptest;mysql_socket=/tmp/mysqld_andrewbackuptest_3510.sock','xaviea',...) failed: Can't co#!/usr/bin/perl -w
nnect to local MySQL server through socket '/tmp/mysqld_andrewbackuptest_3510.sock' (22) at dbconnect.pl line 11.

Lalit Choudhary 
August 11, 2020 at 12:43 PM

not reproduciable.

Lalit Choudhary 
August 11, 2020 at 12:41 PM

Hi

Not reproduciable in my test. Please post this issue on our forum.

https://forums.percona.com/categories/percona-xtrabackup

Test:

 

 

 

 

Rob Schwyzer 
August 6, 2020 at 7:53 PM

Rob Schwyzer 
August 6, 2020 at 4:56 PM

Cannot Reproduce

Details

Assignee

Reporter

Components

Affects versions

Priority

Created August 5, 2020 at 9:46 PM
Updated March 6, 2024 at 6:54 PM
Resolved August 11, 2020 at 12:43 PM