I am not a Mac owner, but the process is the same in general regardless of platform:
- you write an utility program that listens to the socket for requests.
- when your program gets a request, it translates it into MySQL's dialect of SQL.
- it sends that request to the MySQL daemon/service and waits for a response.
- when it gets the response, it reads it record by record and sends the
content back to the requester by means of the socket interface.
- then it sits and waits for the next request.
The socket is merely the pipe through which data passes. It does not know how to do anything except accept data to be sent to the other end of the connection or deliver data to you, sent from the other end.
You must write, or find, a program to do any other work that you want to do. In this case, that other work is to move data between the MySQL (or MariaDB) database and the socket.