1

I'm properly establishing SSH tunnel and I can connect to MySQL users accesible via tcp connection but I don't know how to connect to users accesible only by unix socket. I know the correct socket location: /var/lib/mysql/mysql.sock and I can connect to it from the command line.

How do I connect via socket using HeidiSQL? Is this impossible when SSH tunnel is being used? When I enter '/var/lib/mysql/mysql.sock' into "Host/IP" then I get

Lost connection to MySQL server at 'handshake: reading initial communication packet', system error 22

UPDATE

My HeisiSQL connection settings:

Servers\ATLANTIS\SessionCreated<|||>1<|||>2020-08-14 13:03:22 Servers\ATLANTIS\Host<|||>1<|||>/var/lib/mysql/mysql.sock Servers\ATLANTIS\WindowsAuth<|||>3<|||>0 Servers\ATLANTIS\CleartextPluginEnabled<|||>3<|||>0 Servers\ATLANTIS\User<|||>1<|||>atlantis Servers\ATLANTIS\Password<|||>1<|||>7 Servers\ATLANTIS\LoginPrompt<|||>3<|||>0 Servers\ATLANTIS\Port<|||>1<|||>3306 Servers\ATLANTIS\NetType<|||>3<|||>2 Servers\ATLANTIS\Compressed<|||>3<|||>0 Servers\ATLANTIS\LocalTimeZone<|||>3<|||>0 Servers\ATLANTIS\QueryTimeout<|||>3<|||>30 Servers\ATLANTIS\KeepAlive<|||>3<|||>20 Servers\ATLANTIS\FullTableStatus<|||>3<|||>1 Servers\ATLANTIS\Databases<|||>1<|||> Servers\ATLANTIS\Library<|||>1<|||>libmariadb.dll Servers\ATLANTIS\Comment<|||>1<|||> Servers\ATLANTIS\StartupScriptFilename<|||>1<|||> Servers\ATLANTIS\TreeBackground<|||>3<|||>536870911 Servers\ATLANTIS\SSHtunnelHost<|||>1<|||>atlantis.localdomain Servers\ATLANTIS\SSHtunnelHostPort<|||>3<|||>22 Servers\ATLANTIS\SSHtunnelUser<|||>1<|||>atlantis Servers\ATLANTIS\SSHtunnelPassword<|||>1<|||>6 Servers\ATLANTIS\SSHtunnelTimeout<|||>3<|||>4 Servers\ATLANTIS\SSHtunnelPrivateKey<|||>1<|||>C:\secure-folder\private-key.ppk Servers\ATLANTIS\SSHtunnelPort<|||>3<|||>3307 Servers\ATLANTIS\SSL_Active<|||>3<|||>0 Servers\ATLANTIS\SSL_Key<|||>1<|||> Servers\ATLANTIS\SSL_Cert<|||>1<|||> Servers\ATLANTIS\SSL_CA<|||>1<|||> Servers\ATLANTIS\SSL_Cipher<|||>1<|||> Servers\ATLANTIS\IgnoreDatabasePattern<|||>1<|||> Servers\ATLANTIS\RefusedCount<|||>3<|||>5

Grzegorz Adam Kowalski
  • 5,243
  • 3
  • 29
  • 40
  • can you please show a sanitized version of your connection attempt, the server didn't even react to a handshake, that is the communication directly after the hello message. so you should also check the server logs – nbk Sep 07 '20 at 12:43
  • @nbk, I've updated my question with HeidiSQL connection settings. – Grzegorz Adam Kowalski Sep 07 '20 at 12:57
  • ssh is a tunnel and you have configure the connection correctly so that the packages are sent through the tunnel. of course it could only be a short timeout – nbk Sep 07 '20 at 13:02
  • SSH connection is configured properly. It works for any other app and also works for HeidiSQL when connecting to MySQL via TCP. – Grzegorz Adam Kowalski Sep 07 '20 at 14:15
  • 1
    You said you entered your socket path into the "Hostname + IP" field. If you selected Network type "MySQL (SSH tunnel)", you then have to enter the SSH host in the "SSH tunnel" tab. Did you do that? Or do you want to create the tunnel outside of HeidiSQL? – Anse Sep 07 '20 at 16:41

1 Answers1

0

Remotely, the command should be executed like: mysql -u mySqlUser -p mySqlPw -h localhost.

ssh remote-user@remote "mysql -u mySqlUser -p mySqlPw -h localhost"

As from there, you should be able to do your stuff

Olaf
  • 1
  • 2
  • I don't understand how is this related to HeidiSQL. How do I enter above command into the application? – Grzegorz Adam Kowalski Sep 07 '20 at 12:59
  • There are some background info, regarding HeidiSQL and ssh: https://www.heidisql.com/forum.php?t=17853. It seems to be selective in respect of the ssh client used – Olaf Sep 07 '20 at 13:15
  • but my SSH tunnel connection works fine. There is nothing wrong with it. Problem seems to be related to what HeidiSQL does AFTER setting up tunnel. – Grzegorz Adam Kowalski Sep 07 '20 at 14:17