Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/347.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/55.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java mySQL远程数据库未连接_Java_Mysql_Jdbc_Google Cloud Platform - Fatal编程技术网

Java mySQL远程数据库未连接

Java mySQL远程数据库未连接,java,mysql,jdbc,google-cloud-platform,Java,Mysql,Jdbc,Google Cloud Platform,我有什么遗漏吗? 我的远程MySQL数据库位于谷歌云上,我允许访问我当前的外部IP: String myDriver = "org.gjt.mm.mysql.Driver"; String myURL = "jdbc:mysql://<remote IP address here>:3306/test"; System.setProperty("useSSL", "true"); System.setProperty("user", "test"); System.setProper

我有什么遗漏吗? 我的远程MySQL数据库位于谷歌云上,我允许访问我当前的外部IP:

String myDriver = "org.gjt.mm.mysql.Driver";
String myURL = "jdbc:mysql://<remote IP address here>:3306/test";
System.setProperty("useSSL", "true");
System.setProperty("user", "test");
System.setProperty("password", "test");
System.setProperty("javax.net.ssl.keyStore","lib\\keystore");
System.setProperty("javax.net.ssl.keyStorePassword","password here");
System.setProperty("javax.net.ssl.trustStore","lib\\truststore");
System.setProperty("javax.net.ssl.trustStorePassword","password here");
Class.forName(myDriver);
connection = DriverManager.getConnection(myURL, System.getProperties());
System.out.println("Connection successful.");
String myDriver=“org.gjt.mm.mysql.Driver”;
String myURL=“jdbc:mysql://:3306/test”;
System.setProperty(“useSSL”、“true”);
System.setProperty(“用户”、“测试”);
系统设置属性(“密码”、“测试”);
set属性(“javax.net.ssl.keyStore”、“lib\\keyStore”);
setProperty(“javax.net.ssl.keystrepassword”、“此处的密码”);
set属性(“javax.net.ssl.trustStore”、“lib\\trustStore”);
setProperty(“javax.net.ssl.trustStorePassword”、“此处的密码”);
Class.forName(myDriver);
connection=DriverManager.getConnection(myURL,System.getProperties());
System.out.println(“连接成功”);
它告诉我访问被拒绝

以下是stacktrace:

Access denied for user 'test'@'my external IP' (using password: YES)
java.sql.SQLException: Access denied for user 'test'@'my external IP' (using password: NO)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:957)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3878)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3814)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:871)
at com.mysql.jdbc.MysqlIO.proceedHandshakeWithPluggableAuthentication(MysqlIO.java:1694)
at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1215)
at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2255)
at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2286)
at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2085)
at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:795)
at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:44)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:404)
at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:400)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:327)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at Test.main(Test.java:16)
用户“测试”@“我的外部IP”的访问被拒绝(使用密码:是) java.sql.SQLException:拒绝用户“测试”@“我的外部IP”的访问(使用密码:否) 位于com.mysql.jdbc.SQLError.createSQLException(SQLError.java:957) 在com.mysql.jdbc.MysqlIO.checkErrorPacket上(MysqlIO.java:3878) 在com.mysql.jdbc.MysqlIO.checkErrorPacket上(MysqlIO.java:3814) 在com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:871)上 在com.mysql.jdbc.MysqlIO.proceedHandshakeWithPluggableAuthentication(MysqlIO.java:1694)上 位于com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1215) 位于com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2255) 位于com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2286) 位于com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2085) 位于com.mysql.jdbc.ConnectionImpl(ConnectionImpl.java:795) 位于com.mysql.jdbc.JDBC4Connection(JDBC4Connection.java:44) 位于sun.reflect.NativeConstructorAccessorImpl.newInstance0(本机方法) 位于sun.reflect.NativeConstructorAccessorImpl.newInstance(未知源) 位于sun.reflect.delegatingConstructor或AccessorImpl.newInstance(未知源) 位于java.lang.reflect.Constructor.newInstance(未知源) 位于com.mysql.jdbc.Util.HandleneInstance(Util.java:404) 位于com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:400) 位于com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:327) 位于java.sql.DriverManager.getConnection(未知源) 位于java.sql.DriverManager.getConnection(未知源) at Test.main(Test.java:16)
检查是否可以使用以下命令远程登录ip地址。 telnet远程ip端口

例如,如果u telnet google@port 80:

telnet 8.8.8.8 80

您将看到以下响应:

正在尝试8.8.8.8。。。 连接到8.8.8.8。 转义字符为“^]”


当使用telnet远程ip时,应观察到类似的结果。如果没有,要么是谷歌云没有打开该端口,要么是你的ISP提供商阻止了@port 3306的传出流量。

我有mySQL Workbench,我可以从它连接到远程数据库,通过SSL等访问它,为什么我需要尝试telnet?另外,我目前使用的笔记本电脑有windows 10显示详细信息/stacktrace