mysql error: Can't connect to local MySQL server through socket '/var/run/mysql/mysql.sock' (13 "Permission denied")

Today I updated my SLES 12 SP1 server to install WebApp 3.30. This also updated maria db to “mariadb-10.0.30-25.1.x86_64”. kopano was already on 8.3.0. Unfortunately kopano-server can’t connect to mysql:

Wed May 17 20:05:01 2017: [error  ] KDatabase::Connect(): database access error -2147483641, mysql error: Can't connect to local MySQL server through socket '/var/run/mysql/mysql.sock' (13 "Permission denied")
Wed May 17 20:05:01 2017: [crit   ] Unable to connect to database: MYSQL not initialized
Wed May 17 20:05:01 2017: [notice ] Waiting for mysql_server_end
Wed May 17 20:05:01 2017: [notice ] Waiting for mysql_library_end
Wed May 17 20:05:01 2017: [ notice] Server shutdown complete.

I am able to connect to mysql:

mysql -u root -p

also the socket exists.

As temporarily solution I modified kopano-server to connect to the server’s IP address.

Are any known issues with “kopano-server-8.3.0~1042-2.1.x86_64” and “mariadb-10.0.30-25.1.x86_64”?

Walter

Can confirm this report.

Switching from socket connection to tcp (127.0.0.1 instead of localhost in server.cfg) worked as well.

SLES12 SP2

Using 127.0.0.1 in server.cfg did not solved this issue in my case.

Also socket seams correct:

# l /var/run/mysql/mysql.sock
srwxrwxrwx 1 mysql mysql 0 May 17 19:56 /var/run/mysql/mysql.sock=
#

Could it be your mysql server is configured to only listen to it’s IP adress and not 127.0.0.1 in addition?

(I think this is what happens if you specify the IP as the bind-address in my.conf. It will only listen on the eth interface associated with that IP. If you specify 0.0.0.0 (or leave commented out) mysql server will listen on all devices including the loopback)

looks like some recent update by SuSE has changed the directory persmissions of /var/run/mysql to rwx------
which gives processes running as neither root nor mysql access problems. Changing those permissions back to something a weebit more sensible fixes the errors…

On all Systems I see this permissions:

srwxrwxrwx 1 mysql mysql 0 May  9 14:43 /var/run/mysqld/mysqld.sock=

Checked on 3 systems. So I assume “srwxrwxrwx” is correct.

Which permissions you advice?

@WalterHof

check the directory, not the socket: /var/run/mysql/

they were drwx------ mysql mysql

@RemoStrotkamp
You are right, on SLES 12 SP1 the directory permissions are incorrect:

drwx------  2 mysql  mysql    60 May 17 19:56 mysql/

As example Debian 7:

drwxr-xr-x 2 mysql      root         80 May  9 14:43 mysqld/

This are the propper permissions.

Thank you.