private String sDBDriver = "org.gjt.mm.mysql.Driver
private String sConnStr = "jdbc:mysql://localhost:3306/mytest?user=root&password=system";
Class.forName(sDBDriver);
conn=DriverManager.getConnection(sConnStr);提示错误:
java.lang.NullPointerException
at newsgroup.MysqlConnect.main(MysqlConnect.java:146)
DBConnect():Communication failure during handshake. Is there a server running on localhost:3306?
Exception in thread "main" 我用mysql的客户端连接数据正常。
但是查一下,3306的端口绑定的IP是0.0.0.0,这是为什么,如何解决?
private String sConnStr = "jdbc:mysql://localhost:3306/mytest?user=root&password=system";
Class.forName(sDBDriver);
conn=DriverManager.getConnection(sConnStr);提示错误:
java.lang.NullPointerException
at newsgroup.MysqlConnect.main(MysqlConnect.java:146)
DBConnect():Communication failure during handshake. Is there a server running on localhost:3306?
Exception in thread "main" 我用mysql的客户端连接数据正常。
但是查一下,3306的端口绑定的IP是0.0.0.0,这是为什么,如何解决?
# SERVER SECTION
# ----------------------------------------------------------------------
#
# The following options will be read by the MySQL Server. Make sure that
# you have installed the server correctly (see above) so it reads this
# file.
#
[mysqld]# The TCP/IP Port the MySQL Server will listen on
port=3306如果是默认设置,3306端口是没错的。