MySQL Connector/J 8.0 Developer Guide

6.10 Connecting Using Unix Domain Sockets

Connector/J does not natively support connections to MySQL Servers with Unix domain sockets. However, there is provision for using 3rd-party libraries that supply the function via a pluggable socket factory. Such a custom factory should implement the com.mysql.cj.protocol.SocketFactory interface or the legacy com.mysql.jdbc.SocketFactory interface of Connector/J. Follow these requirements when you use such a custom socket factory for Unix sockets :

Note

For X Protocol connections, the provision to use custom socket factory for Unix socket connefctions is only available for Connector/J 8.0.12 and later.