How to connect to mariadb via unix socket?


I would like to try the database tools included in PhpStorm but it surprisingly does not even let me connect to the mariadb demon via its socket at /run/mysqld/mysqld.sock (the CLI client works fine).

I only found some post for mysql suggesting using junixsocket, installed the recommended JARs as additional drivers and tried the JDBC URL
but only got the most useless error message: "Connection is closed."


I also tried to use the mysql driver (also plus the junixsocket JARs) with the JDBC URL
but only got the following error:

[08S01] Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. No such file or directory.


How does one connect to a mariadb instance in PhpStorm via a unix domain socket file?


Here is instruction how to connect to MySQL via Unix socket.

If it does not help, please try the same steps but with latest Maria connector, also they say some third-party libraries are required. (JNA ( and JNA-PLATFORM ( 4.2.1 or greater are also needed when you would like to connect to the server with Unix sockets or windows pipes.) JDBC URL could be like this - jdbc:mariadb://localhost:3306/revmgt?localSocket=/var/run/mysqld/mysqld.sock


I did not get it to work with the included or the newest MariaDB driver.
But with the JNA libs added and the advanced values enetered, it now works fine with the included MySQL driver.

Thanks for the pointers and please consider adding out-of-the-box unix domain socket support to the product.
Then other Linux users wouldn't need to jump through that hoops (we are way more spoiled by our all-inclusive repos, than the Windows folks which generally seem to like downloading and configuring drivers and tools themselves).



I'm using SSH Tunnel and want to access to socket file from the server and got these errors.


Please sign in to leave a comment.