[BlueOnyx:20587] Re: MariaDB problem with 127.0.0.1 *** fixed ***

Michael Stauber mstauber at blueonyx.it
Tue Jan 24 06:02:25 -05 2017


Hi Michael,

Regarding MariaDB on 5209R and the connection problem to MariaDB I have
some new info and a solution:

Problem:
=========

Connection to MariaDB as user at localhost not working, but user at 127.0.0.1
works.

This problem generally happens if IPv6 is enabled. In that case a lookup
of "localhost" returns both 127.0.0.1 and ::1. In which case PHP will
not use the network to connect to these localhost IP's - instead it
tries to use a socket connection to the Unix socket of MariaDB.

That socket resides in either /var/lib/mysql/mysql.sock or
/home/mysql/mysql.sock.

But: That directory is not work readable. Hence the unprivileged PHP
user cannot access the socket and the socket connection fails. So the
solution to this problem is ridiculously simple:

Solution:
=========

chmod 755 /home/mysql 		(if it exists)
chmod 755 /var/lib/mysql

I'll release an update which fixes the permissions.

/facepalm

-- 
With best regards

Michael Stauber



More information about the Blueonyx mailing list