Ubuntu下MySQL不能连接问题的解决 MESSAGE: java.net.ConnectException: Connection refused

通过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

你可能感兴趣的:(Ubuntu下MySQL不能连接问题的解决 MESSAGE: java.net.ConnectException: Connection refused)