Cyclone
Cyclone

Reputation: 15269

MySQL remote access via SSH Tunnel error

I've created an SSH tunnel on my local machine to reach an access to the mysql server on my remote machine. Everything is fine, tunnel is working if I get this error, but why this error occurs?

Here is the error message:

2013 - Lost connection to MySQL server at 'reading initial communication packet', system error: 0

It happends only, when I want to connect via Navicat (SSH Tunnel) from my local to the remote machine, on the remote machine mysql works without such errors.

Have you guys any solutions for that?

Upvotes: 1

Views: 3138

Answers (2)

Anil Singh
Anil Singh

Reputation: 339

Login to your local Linux machine then run this command:

ssh -L 3307:localhost:3306 -N [email protected]

Use the mysql database from remote server:

mysql -u root -p --port 3307 -h 127.0.0.1

Make sure the local mysql does not use the same port in Linux environment.

Upvotes: 1

dom
dom

Reputation: 651

This error occurs when the configuration of the bind-adress option is wrong. Your MySQL server at least should listen on the localhost - 127.0.0.1

Upvotes: 2

Related Questions