I want to make remote connection via socket pipe (mysql.sock
) on remote server, which is mounted to directory using sshfs
. But I experience some problems. Here's an example:
I have 2 servers. One of them is mysql server behind NAT (but ssh port is opened). So I can't directly open an mysql connection by:
mysql -h mysql-server -u root -p
I tried mount mysql-server using sshfs:
sshfs user@mysql-server:/ ~/db
Remote mysql.sock
file in now located under:
~/db/var/lib/mysql/mysql.sock
but after calling:
mysql --socket=~/db/var/lib/mysql/mysql.sock -u root -p
I got:
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '~/db/var/lib/mysql/mysql.sock' (111)
bind-address
is not present in config file.
So the question is: How to connect to remote socket in directory mounted through ssh?
OR
Is there any possibility to connect to remote mysql using ssh (all others ports are closed)? I need it to use with php later...