通过JDBC连接mysql出现连接被拒绝:
** BEGIN NESTED EXCEPTION **
java.net.SocketException
MESSAGE: java.net.ConnectException: Connection refused
STACKTRACE:
java.net.SocketException: java.net.ConnectException: Connection refused
at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:156)
解决方法如下:
在/etc/mysql/my.cnf中注释掉bind-address这一行
然后sudo /etc/init.d/mysql restart