MySql and MAMP

I am new to phpstorm and having problems connecting to mySql in my mamp installation.

I am using MAMP Pro and phpstorm 6.0.3.

I am connecting to the database with phpMyAdmin, and Sequel Pro without problems.

My Data Source is:
JDBC driver files: mysql-connector-java-5.1.26-bin.jar

JDBC driver class: com.mysql.jdbc.Driver

I have tried following URL:
jdbc:mysql://localhost:3306
jdbc:mysql://localhost
jdbc:mysql://127.0.0.1:3306
jdbc:mysql://127.0.0.1

User: root
Password: xxxxx

On Test Connection I get this error:

Connection to MAMPlocal 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:39)
 at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
 at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
 at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
 at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1121)
 at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:357)
 at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2482)
 at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2519)
 at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2304)
 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:39)
 at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
 at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
 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)
 in RemoteDriverImpl.connect(RemoteDriverImpl.java:27)
 at com.sun.proxy.$Proxy88.connect(Unknown Source)
 in LocalDataSource.getConnection(LocalDataSource.java:158)
Caused by: java.net.ConnectException: Connection refused
 at java.net.PlainSocketImpl.socketConnect(Native Method)
 at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:382)
 at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:241)
 at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:228)
 at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:431)
 at java.net.Socket.connect(Socket.java:527)
 at java.net.Socket.connect(Socket.java:476)
 at java.net.Socket.<init>(Socket.java:373)
 at java.net.Socket.<init>(Socket.java:216)
 at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:259)
 at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:307)
 at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2482)
 at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2519)
 at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2304)
 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:39)
 at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
 at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
 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)
 in RemoteDriverImpl.connect(RemoteDriverImpl.java:27)



Any suggestions will be apriciated. Thanks
3 comments

Well .. quick googling shows this -- maybe it will be helpful:

http://stackoverflow.com/questions/2121829/mysql-jdbc-communications-link-failure

See if you can grant full access to MySQL from any address/host -- maybe Java (PhpStorm is a Java app) access it a bit differently?

0

Hi, guys, in order to connect to MAMP MySQL server, enable the configuration "Allow network access to MySQL" on MAMP configurations :)

1

Please sign in to leave a comment.