Comments - Remote access database without password

8 months, 3 weeks ago Daniel Black

As the unix_socket is on the filesystem it is inherently not remote.

You can tunnel via ssh to make a local connection, tcp or unix, appear to the database as if its coming from the unix socket.

This is done by:

ssh -L /tmp/mylocalsocket.socket:/run/mysqld/mysqld.sock [email protected]

Then MariaDB connections to /tmp/mylocalsocket will end up being transported over ssh and appear as a connection to the database socket, just as if it was local.

As a tcp option:

ssh -L localhost:3306:/run/mysqld/mysqld.sock [email protected]

This will make port 3306 connections locally appear at the unix socket.

Note for both cases it must be the "user" that is granted the unix_socket authentication on the database.

 
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.