PhpStorm 无法连接远程 MySQL 数据库
在 Linode 搭建了一个 Linux 服务器(Ubuntu 18.04)。使用 PhpStorm 远程连接一直失败,检索各种方案尝试无果。请各位大大帮忙指点迷津,感谢!
设置如下:
报错截图:
系统log:
2018-05-24 15:19:27,640 [26377197] INFO - ution.rmi.RemoteProcessSupport - Terminating: 4791/RemoteDriverImpl42c8892f
2018-05-24 15:19:27,657 [26377214] INFO - ution.rmi.RemoteProcessSupport - Process finished with exit code -1
2018-05-24 15:19:27,973 [26377530] INFO - ution.rmi.RemoteProcessSupport - "C:Program FilesJetBrainsPhpStorm 2018.1.3jre64binjava" -Djava.net.preferIPv4Stack=true -Djava.rmi.server.hostname=127.0.0.1 -Duser.timezone=UTC -Dfile.encoding=UTF-8 -classpath "C:Program FilesJetBrainsPhpStorm 2018.1.3libutil.jar;C:Program FilesJetBrainsPhpStorm 2018.1.3libtrove4j.jar;C:Program FilesJetBrainsPhpStorm 2018.1.3libgroovy-all-2.4.12.jar;C:Program FilesJetBrainsPhpStorm 2018.1.3pluginsDatabaseToolslibjdbc-console.jar;C:Program FilesJetBrainsPhpStorm 2018.1.3pluginsDatabaseToolslibdekaf-single-2.0.0.353.jar;C:Userswill.PhpStorm2018.1configjdbc-driversMySQL ConnectorJ5.1.46mysql-connector-java-5.1.46.jar;C:Userswill.PhpStorm2018.1configjdbc-driversMySQL ConnectorJ5.1.46mysql-connector-license.txt" com.intellij.database.remote.RemoteJdbcServer com.mysql.jdbc.Driver
2018-05-24 15:19:28,148 [26377705] INFO - ution.rmi.RemoteProcessSupport - Terminating: 11026/RemoteDriverImplb9d224e3
2018-05-24 15:19:28,149 [26377706] INFO - ution.rmi.RemoteProcessSupport - Terminating: 6614/RemoteDriverImpla46c136f
2018-05-24 15:19:28,169 [26377726] INFO - ution.rmi.RemoteProcessSupport - Process finished with exit code -1
2018-05-24 15:19:28,172 [26377729] INFO - ution.rmi.RemoteProcessSupport - Process finished with exit code -1
2018-05-24 15:19:28,318 [26377875] INFO - ution.rmi.RemoteProcessSupport - Port/ID: 15700/RemoteDriverImpl9af1f66f
2018-05-24 15:19:28,337 [26377894] INFO - urce.DatabaseConnectionManager - Connecting as: will
2018-05-24 15:19:28,337 [26377894] INFO - urce.DatabaseConnectionManager - Connecting to: jdbc:mysql://..*.121:3306/elvis_store
2018-05-24 15:19:48,934 [26398491] WARN - urce.DatabaseConnectionManager - Connecting to: jdbc:mysql://..*.121:3306/elvis_store
2018-05-24 15:19:48,934 [26398491] WARN - urce.DatabaseConnectionManager - [08S01] Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
2018-05-24 15:19:48,935 [26398492] WARN - lij.database.util.ErrorHandler - Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
java.sql.SQLException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:425)
at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:990)
at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:342)
at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2188)
at com.mysql.jdbc.ConnectionImpl.connectWithRetries(ConnectionImpl.java:2037)
at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2021)
at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:776)
at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:425)
at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:386)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:330)
at com.intellij.database.remote.jdbc.impl.RemoteDriverImpl.connect(RemoteDriverImpl.java:27)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:346)
at sun.rmi.transport.Transport$1.run(Transport.java:200)
at sun.rmi.transport.Transport$1.run(Transport.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:826)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:683)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:682)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.TwoStacksPlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:211)
at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:301)
... 30 more
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这种情况一般检查两个地方
1.服务器的3306端口是否开发
2.你登录的mysql账户是否被允许远程连接