Software, Development, and WordPress

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:


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.


  1. Jason Bradley

    Thanks for that Tom! I was wondering how to set that up for use with MAMP. You just increased my productivity!

    • Tom McFarlin

      That’s the goal :)!

      • Jason Bradley

        Dusting off my SQL skills this morning. It’s pretty crazy how much easier it is to use within Coda 2 instead of having to log in to phpMyAdmin. Thanks again for this Tom.

  2. Gavin

    How are these connections saved in Coda? I keep having to re-type the MySQL credentials into a new “Add – Connect to MySQL Server”.

    • Tom McFarlin

      Just updated the post – check it out. Gives instructions for exactly how to do this.

  3. Kristian

    I’m new to SQL and this tip helped me a lot, so thanks! How do I ‘publish’ the db I created in Coda 2 to my remote db?

    • Tom McFarlin

      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 :).

  4. fatimah

    now this is for local site, what if it is remote site??


    • Tom McFarlin

      In that case, you’d need to specify the connection to your database using MySQL Server via SSH.

  5. Mario

    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?

    • tommcfarlin

      This means that either the MySQL socket isn’t located in that location or that the server isn’t running.

  6. André

    What about not be able to connect to an external server (Host: GoDaddy)?

    • tommcfarlin

      In this case, you’d need to use “MySQL via SSH” but this is also contingent upon your host giving your SSH access.

  7. Clay

    Thanks! This was a huge help!

  8. Yug

    I need to connect to my on server database . How do I achieve that ?

    • Tom McFarlin

      I’m sorry – I don’t understand your question. This post shows how to connect Coda to the installation of the database server running on your local machine.

  9. books

    Yes! Finally someone writes about download.

  10. Ed Prue

    Thanks for this! It’s a gift that’s still giving. I just downloaded and installed the Coda 2 eval today, and it feels good, but help with the learning curve is always — well, helpful!

    • Tom McFarlin

      Awesome – so glad this post was able to help!

      Enjoy Coda 2 – it’s pretty nice, IMHO. Still using it today :).

  11. Jonathon B

    Thanks so much! Exactly what I was looking for :)

    • Tom

      Awesome – glad to hear it!

  12. Eugene

    Thank you! It worked!

    • Tom

      Awesome – glad it helped :).

  13. Ewa

    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!

  14. A

    Is it possible to export db as .sql file with Coda? Good stuff, thanks.

    • Tom

      To my knowledge, no but I’m not positive.

  15. Josh

    I just switched over from MAMP to the local install in Yosemite. Any idea on how to connect via the Coda MySQL tab with this? Thanks!

    • Tom

      Hey Josh,

      Unfortunately, I’ve not used the local install – just with MAMP so I’m afraid I don’t have much to offer you in the way of help right now.

Leave a Reply

© 2020 Tom McFarlin

Theme by Anders NorenUp ↑