I'm having trouble accessing a remote mysql server (that is set to skip-networking/no remote connections). I've been able to successfully create a ssh tunnel, but how can I access the server's mysql socket over that tunnel?
You'll need to have some kind of IP method to access that mysql server remotely, using only sockets will give you access to that mysql server from the local machine.
Your best option here would be activating networking but firewalling the mysql server so it's only accessible from localhost, then once you get your tunnel working it should be fairly straightforward to connect remotely through the ssh tunnel either directly from the command line
ssh -L 3306:localhost:3306 user@server or using .ssh/config
LocalForward 3306 localhost:3306
If the mysql server is configured to allow no network connections, then its will only talk to programs connecting via the file socket. You've created a pipe which ends at a network socket - you need to create a bridge listening on the network port and connecting to the file socket.
I believe it's possible to do this with netcat - something like.....
nc -U -l 3306 /var/lib/mysql/mysql.sock
...but do RTFM and experiment.
@Lynxman, when mysql is running with --skip-network option you can not connect using TCP because it is not listening on 3306 port and connection can be made only using sockets.
Netcat wouldn't do the trick. From the manual this is what I found.
Create and listen on a Unix Domain Socket:
$ nc -lU /var/tmp/dsocket