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:
1 2 3 4 5 6 7 8 9 10 | ** BEGIN NESTED EXCEPTION ** java.io.EOFException STACKTRACE: java.io.EOFException at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:1934) at com.mysql.jdbc.MysqlIO.readPacket(MysqlIO.java:483) at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:992) at com.mysql.jdbc.Connection.createNewIO(Connection.java:2572) <...> |
I found the solution here, edit /etc/mysql/my.cnf, comment out the line “skip-networking” and add the “bind-address…” line:
1 2 3 4 5 6 7 | <...> # 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 #skip-networking 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).



