I wanted to connect my MySql server via SSH from remote, but every time I tried to connect, i received this error message:
“ERROR 2013 (HY000): Lost connection to MySQL server during query” (MySQL Admin) or this error via JDBC:
** BEGIN NESTED EXCEPTION **
I found the solution here, edit /etc/mysql/my.cnf, comment out the line “skip-networking” and add the “bind-address…” line:
# Instead of skip-networking you can now listen only on
# localhost which is more compatible and is not less secure.
# bind-address = 127.0.0.1
bind-address = 127.0.0.1
What did we change? “skip-networking” means, only local (non TCP/IP) connections will be allowed, on Unix, connections will be made through a Unix socket. By adding the “bind-address” option, we force MySql to listen on 127.0.0.1.
Restart mysqld and MySql will work through SSH (TCP port 3306).