Using Navicat with a MAMP MySQL database on Mac OS X

When trying to connect to a MAMP MySQL database with Navicat, I initially got the following unhelpful error message

Connection Failed
Can’t connect to MySQL server on ’127.0.0.1′ (61)

even though all settings (Hostname, Port, User, Password) seemed to be correct. I am not quite sure why this happens, but it can be solved by pointing Navicat to the MAMP MySQL server socket, by setting

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

as the Socket File Path in the “Advanced”-Tab, and you’re done.

21 thoughts on “Using Navicat with a MAMP MySQL database on Mac OS X

  1. please somebody help me….my problem still persist. Mine is saying *can’t connect to local MySql server through socket ‘/tmp/mysql.sock’ *

    Please whats the problem? help a brother

    • Given that it states “/tmp/mysql.sock” as the socket being used, it seems like it hasn’t accepted your configuration. If the connect fails for me, it reads “Can’t connect to local MySQL server through socket ‘/Applications/MAMP/tmp/mysql/mysql.sock’”, which is the correct socket (for me).

      Please make sure you actually set the “Use socket file for localhost connection” setting to the correct path. You can verify if that path exists on the command line by typing “file path_to_socket”

    • This is because Navicat expects the socket, which enables it to connect to MySQL, in a certain list of paths. However, since MAMP provides a completely isolated installation of Apache/PHP/MySQL, the MAMP MySQL socket is placed somewhere else, so that it does not interfere with a separate MySQL installation that could be installed on your system.

  2. Screen shot for the latest version of Navicat was different and I was putting that line in the setttings save path, not the “Use Socket Path” section. Just a FYI for others with a newer version. Thanks for the help.

  3. Has anyone got this to work in navicat version 11 Mac App Store Version. I had it working fine in version 10 as described above but when I upgraded it stopped working. I contacted navicat support and they say:

    “Thanks for your email. Due to a new restriction from Apple, users now need to move the socket file into a folder under ~/Library/Containers/com.prect.Navicat/Data For example, ~/Library/Containers/com.prect.Navicat/Data/tmp/mysql.sock

    Then set the permissions of the folder (e.g. giving the tmp folder a permission of 777 and all its parent folders to 701). After that, in Connection Properties window, Advanced tab, input the new file location in “Use socket file” text box.”

    unfortunately I do not really understand this and have yet to get it to work.

  4. A solution from Navicat support that works.

    “Thanks for your email. Due to a new restriction of Mac App Store, it has restricted the access to MySQL socket file. And by default, MAMP require the connection using socket file. In order to connect to MySQL server without using the socket file, in MAMP Pro control panel -> MySQL page, please uncheck “Allow local access only” and restart the MySQL server to try again.

    ** Please uncheck “Use socket file” checkbox in Navicat’s Connection Properties -> Advanced page”

    • I was having the exact same trouble too. This fix worked great for me.

      In the interm while Navicat wasn’t working, I was using Sequel Pro for Mac, http://www.sequelpro.com. It didn’t have the version upgrade connection problem but it’s not a replacement for Navicat. It performed the tasks I needed it to at the time. Not to mention it’s free.

  5. I don’t have this file mysql.sock in Application/MAMP/tmp/mysql directory.

    Trying to connect to the local., getting error “can’t connect to MySQL server on ’127.0.0.1(61)”.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>