mief.nl

Setting up DB Navigator in PhpStorm + MAMP

I was quite curious to test drive the DB Navigator plugin for PhpStorm. I thought the installation would be as simple as other plugins available but it did take some time to find the right settings. Unfortunately the documentation for this plugin lacked a bit of configuration tips.

Also when I got the plugin working I noticed a problem with MAMP. Trying to connect to the server it failed miserably with the error “‘reading initial communication packet’, system error: 61” whatever that means.

So here is how I got everything working like it should.

  • First off download the ‘Database Navigator’ plugin from within PhpStorm. I’m assuming you know how. After it is installed apply and restart PhpStorm.
  • Now go ahead and download the JDBC driver for MySQL. Unpack it somewhere as long as you know where it is.
  • In PhpStorm go to your settings. Under the section ‘Project Settings’ you should be able to see ‘Database Navigator’. Go ahead and unfold it and click on Connections.
  • Add a new connection and fill out the fields.
    • Driver Library: Browse to your recently unpacked JDBC driver connector files and select mysql-connector-java-5.1.17-bin.jar
    • The driver should be ok, ‘com.mysql.jdbc.Driver’
    • URL: The url works as follows; jdbc:mysql://\<HOST>:\<PORT>/\<DATABASE> so for a localhost connection to the database “lab” it could read jdbc:mysql://localhost:3306/lab
    • Don’t forget your user and password :-)

Now if you are not using MAMP or you know you are not using socket only connections all should be fine and you can start exploring Database Navigator. If not, read on.

MAMP

If you are like me and you are using MAMP (in my case 2.x) you will receive a connection failure such as ‘Mysql Connection lost: reading initial communication packet’, system error: 61”.

Yes, annoying but the solution is simple! Go to the main window of MAMP and choose File → Edit Template → MySql My.cnf. Find the line MAMP_skip-networking_MAMP and comment this line. Now restart your servers and you are ready to go! PhpStorm is now also able to connect.

And thats it. Still figuring out all the features of Database Navigator but it sure looks promising. Have fun!

  

Add new comment