当我想连接到 mysql 数据库时,ip 似乎发生了变化。问题是什么?
Class.forName("com.mysql.jdbc.Driver").newInstance();
String url = "jdbc:mysql://192.168.0.135:3306/kinderopvang";
String userName = "wim";
String password = "wim";
Connection conn=DriverManager.getConnection(url,userName,password);
这是错误:
java.sql.SQLException: Access denied for user 'wim'@'192.168.0.205' (using password: YES)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1078)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4187)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4119)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:927)
at com.mysql.jdbc.MysqlIO.secureAuth411(MysqlIO.java:4686)
at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1304)
at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2483)
at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2516)
at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2301)
at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:834)
at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:416)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:346)
at java.sql.DriverManager.getConnection(DriverManager.java:579)
at java.sql.DriverManager.getConnection(DriverManager.java:221)
at controller.db.GebruikerDatabankSQL.testGebruikerDatabankSQL(GebruikerDatabankSQL.java:31)
at run.NewMain.main(NewMain.java:341)
如您所见,我想连接到 IP 地址 192.168.0.135 但我连接到 192.168.0.205 这是我自己的 IP 地址