Configure Coda 2 To Connect MySQL

If you’ve recently installed or upgraded to Coda 2, are using MAMP to manage your development stack, and are looking to use the built-in MySQL frontend, here’s what you need to do in order to connect to MySQL in Coda 2.

Coda 2 and MAMP MySQL Socket

Setting up a connection between your project and its database is easy. It really only takes a single step though it assumes you know the username and password to your local database (which I can’t imagine why you wouldn’t know it :).

MySQL in Coda 2

First, select ‘MySQL Socket’ from the Connect To area then paste the following line into the ‘Socket’ field:

/Applications/MAMP/tmp/mysql/mysql.sock

This will then allow Coda to connect to the databases you’ve likely been managing with another client such as phpMyAdmin.

In the comments, Gavin asked how to store the settings for a given site or application. To do this:

  • Go to the Coda 2 home screen where it lists all of your projects.
  • Two-finger click on the site and click on ‘Edit’
  • Click on the ‘Database’ tab and enter the socket information

Coda 2 Edit Site

This will store the settings so you won’t have to enter it each time for each site.

30 Replies to “Configure Coda 2 To Connect MySQL”

    1. To my knowledge, Coda 2 doesn’t actually support this functionality, but you could do an export and then import that into your remote environment.

      The tricky part about that is making sure all of your URL’s are still properly defined in the database; otherwise, you’ll have problems :).

  1. Hi Tom, I followed your instructions but all I get is this error:

    Unable to connect to host /Applications/MAMP/tmp/mysql/mysql.sock, or the request timed out.

    Be sure that the address is correct and that you have the necessary privileges, or try increasing the connection timeout (currently 0 seconds).

    MySQL said: Can’t connect to MySQL server on ‘/Applications/MAMP/tmp/mysql/mysql.sock’ (60)

    —-

    Any ideas what I have done wrong?

  2. For those novices who still can’t get it working (i.e. read: myself…), you have to find where the file “mysql.sock” is and enter that location into field “Socket:”. In my case the file was simply in the /tmp folder. I have no idea how it got there or what this location implies, but right now the most important thing is that I got the connection! Thanks Tom, this was a good starting point!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.