Mysql

嘗試連接以從 Intellij IDEA 中刪除 MySQL 時出現異常

  • October 1, 2015

我無法從Jetbrains IDAAWS 連接到我的 MySQL。我得到了例外:

Connection to MySQL - aws failed
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:57)
   at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
   at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
   at com.mysql.jdbc.Util.handleNewInstance(Util.java:389)
   at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1038)
   at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:338)
   at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2237)
   at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2270)
   at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2069)
   at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:794)
   at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:44)
   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:526)
   at com.mysql.jdbc.Util.handleNewInstance(Util.java:389)
   at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:399)
   at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:325)
   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:57)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:606)
   at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:322)
   at sun.rmi.transport.Transport$2.run(Transport.java:202)
   at sun.rmi.transport.Transport$2.run(Transport.java:199)
   at java.security.AccessController.doPrivileged(Native Method)
   at sun.rmi.transport.Transport.serviceCall(Transport.java:198)
   at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:567)
   at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:828)
   at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.access$400(TCPTransport.java:619)
   at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler$1.run(TCPTransport.java:684)
   at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler$1.run(TCPTransport.java:681)
   at java.security.AccessController.doPrivileged(Native Method)
   at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:681)
   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
   at java.lang.Thread.run(Thread.java:745)
   at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:275)
   at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:252)
   at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:161)
   at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:217)
   at java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:171)
   at com.sun.proxy.$Proxy114.connect(Unknown Source)
   at sun.reflect.GeneratedMethodAccessor541.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:606)
   at com.intellij.execution.rmi.RemoteUtil.invokeRemote(RemoteUtil.java:124)
   at com.intellij.execution.rmi.RemoteUtil.access$100(RemoteUtil.java:36)
   at com.intellij.execution.rmi.RemoteUtil$RemoteInvocationHandler.invoke(RemoteUtil.java:229)
   at com.sun.proxy.$Proxy115.connect(Unknown Source)
   at com.intellij.database.dataSource.LocalDataSource.getConnection(LocalDataSource.java:240)
   at com.intellij.database.dataSource.LocalDataSource.getConnection(LocalDataSource.java:208)
   at com.intellij.database.dataSource.DataSource.getConnection(DataSource.java:361)
   at com.intellij.database.dataSource.DataSource.performJdbcOperation(DataSource.java:405)
   at com.intellij.database.dataSource.AbstractDataSource.refreshMetaData(AbstractDataSource.java:32)
   at com.intellij.database.dataSource.DataSourceUiUtil$3.run(DataSourceUiUtil.java:180)
   at com.intellij.openapi.progress.impl.CoreProgressManager$TaskRunnable.run(CoreProgressManager.java:563)
   at com.intellij.openapi.progress.impl.CoreProgressManager$8.run(CoreProgressManager.java:367)
   at com.intellij.openapi.progress.impl.CoreProgressManager$2.run(CoreProgressManager.java:152)
   at com.intellij.openapi.progress.impl.CoreProgressManager.a(CoreProgressManager.java:452)
   at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:402)
   at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:54)
   at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:137)
   at com.intellij.openapi.application.impl.ApplicationImpl$10$1.run(ApplicationImpl.java:617)
   at com.intellij.openapi.application.impl.ApplicationImpl$8.run(ApplicationImpl.java:400)
   at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
   at java.util.concurrent.FutureTask.run(FutureTask.java:262)
   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
   at java.lang.Thread.run(Thread.java:745)
   at org.jetbrains.ide.PooledThreadExecutor$1$1.run(PooledThreadExecutor.java:56)
Caused by: java.net.ConnectException: Connection timed out
   at java.net.PlainSocketImpl.socketConnect(Native Method)
   at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
   at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
   at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
   at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
   at java.net.Socket.connect(Socket.java:579)
   at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:213)
   at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:297)
   at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2237)
   at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2270)
   at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2069)
   at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:794)
   at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:44)
   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:526)
   at com.mysql.jdbc.Util.handleNewInstance(Util.java:389)
   at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:399)
   at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:325)
   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:57)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:606)
   at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:322)
   at sun.rmi.transport.Transport$2.run(Transport.java:202)
   at sun.rmi.transport.Transport$2.run(Transport.java:199)
   at java.security.AccessController.doPrivileged(Native Method)
   at sun.rmi.transport.Transport.serviceCall(Transport.java:198)
   at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:567)
   at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:828)
   at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.access$400(TCPTransport.java:619)
   at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler$1.run(TCPTransport.java:684)
   at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler$1.run(TCPTransport.java:681)
   at java.security.AccessController.doPrivileged(Native Method)
   at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:681)
   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
   at java.lang.Thread.run(Thread.java:745)

MySQL版本:5.5.44-0ubuntu0.14.04.1

Ubuntu 14.04.2

/var/log/mysql/error.log嘗試連接時我看不到任何東西。

/etc/mysql/mycnf有預設設置 - 我只bind-address從更改127.0.0.10.0.0.0

我正在嘗試通過 SSH 連接 - 但也有一個例外。

  1. 首先,您需要使用-not in檢查與MySQL終端的遠端連接。mysql``IDEA
  2. phpmyadmin轉到Users並點擊Edit Privileges您將用於登錄的使用者,然後在下一個螢幕上更改LocalhostAny hostphpmyadmin 使用者更改登錄資訊

在這個答案中查看更多資訊。

引用自:https://dba.stackexchange.com/questions/111701