Connect phpStorm to Local "Lightning" database without supporting socket

Hey everyone, sorry for the confusion with this.

The way to connect to the DB depends on the OS that you are using. Macs use sockets, while Windows uses ports. This is because sockets are more performant, but Windows doesn’t support unix sockets.

For those of you using Mac – it looks like there is this project to bring Unix sockets to Java:

https://kohlschutter.github.io/junixsocket/quickstart.html

Maybe you can use that code? I found that project by reading through the steps from this comment in PHPStorm’s Support site. It mentions DataGrip, but that’s part of the IntelliJ family, so maybe this will work for PHPStorm as well?

Download an up-to-date version of junixsocket GitHub - kohlschutter/junixsocket: Unix Domain Sockets in Java (AF_UNIX)

The Ubuntu package is currently 2.04, and did not work for me. The latest at time of writing (2.3.1) did work.

Extract junixsocket somewhere (doesn’t matter, just needs to be accessible to DataGrip.)

In DataGrip’s Data Sources and Drivers Window, select the MySQL driver. Under ‘Driver Files’, click the + button and select:

junixsocket-mysql-2.3.1.jar

junixsocket-core-2.3.1.jar

junixsocket-common-2.3.1.jar

junixsocket-native-common-2.3.1.jar

from wherever you extracted them.

Add a new MySQL datasource, and under ‘Advanced’:

set ‘socketFactory’ to ‘org.newsclub.net.mysql.AFUNIXDatabaseSocketFactory’

and add ‘junixsocket.file’ with the path to our unix socket.

https://intellij-support.jetbrains.com/hc/en-us/community/posts/115000070290/comments/360001349799