Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/64.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
Mysql 从位于服务器上的SpringBoot应用程序连接到远程数据库失败_Mysql_Database_Spring_Spring Boot_Remote Server - Fatal编程技术网

Mysql 从位于服务器上的SpringBoot应用程序连接到远程数据库失败

Mysql 从位于服务器上的SpringBoot应用程序连接到远程数据库失败,mysql,database,spring,spring-boot,remote-server,Mysql,Database,Spring,Spring Boot,Remote Server,我已经在RaspberryPi服务器上部署了我的应用程序,该服务器要求连接到远程MySqldb。这些属性看起来像: # LOCAL DATABASE #spring.datasource.url = jdbc:mysql://localhost:3306/test3?autoReconnect=true&useSSL=false #spring.datasource.username = root #spring.datasource.password = admin # REMOTE

我已经在
RaspberryPi
服务器上部署了我的应用程序,该服务器要求连接到远程
MySql
db。这些属性看起来像:

# LOCAL DATABASE
#spring.datasource.url = jdbc:mysql://localhost:3306/test3?autoReconnect=true&useSSL=false
#spring.datasource.username = root
#spring.datasource.password = admin

# REMOTE DATABASE
spring.datasource.url = jdbc:mysql://modraszka.sth.sth:8822/test3?autoReconnect=true&useSSL=false
spring.datasource.username = root
spring.datasource.password = password
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
但是,当我尝试运行应用程序时,它抛出:


远程数据库与部署的应用程序位于同一服务器上。

检查您的远程数据库是否为internet打开,还是默认为仅在本地运行


看来你的主人鬃毛是无效的(modraszka.sth.sth)

  • 试着敲打它
  • 如果工作正常,尝试使用telnet modraszka.sth.sth 8822远程登录
  • 如果telnet不工作,尝试telnet到telnet modraszka.sth.sth 22

  • 那么它对您不起作用,我们可以假设您必须授予对远程服务器中mysql端口的访问权

    这是因为当我创建一个隧道并将其映射到localhost:9000并在本地运行应用程序时,它就可以工作了。但现在我不想从连接到DB的服务器上运行应用程序,DB也在同一个服务器上,您是否尝试过使用telnet?telnet modraszka.sth8822@reostelnet工作我可以ping并telnet它。根据访问权限,我在一段时间前已授予该用户,因此我拥有所有权限