I had several installations of mysql on my laptop, like brew mysql, brew mariadb, MAMP and plain old Mysql. Now I'm just trying to use plain old mysql after I tried deleting anything that may be related to Mysql and now I can't even start the server. I click to start it and there will be no mysqld process showing in activity monitor. When I try to connect via the command line I get this error.

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/mysqld/mysqld.sock' (2).

I can't seem to figure out why it won't start either. I don't get an error message or anything.

  • Normally the socket directory has to have the ownership of the user the mysql daemon runs with. – Rui F Ribeiro Nov 29 '16 at 2:21
  • You'll have to excuse my noobishness, but I'm still a little unclear on how permissions work. Could you provide some more information please? – Miguel Coder Nov 29 '16 at 6:35
  • or it maybe pointing to the wrong directory... SIP in OSX, google SIP. the directory has to be owned by tipically the mysql or mysql user, do 'ls -la /var/mysqld' – Rui F Ribeiro Nov 29 '16 at 7:22

This error means the file '/var/mysqld/mysqld.sock' doesn't exist. Verifie if mysql-server is installed (it's different from the mysql-client). But if the mysql-server is installed verifie that it's running. if not try restarting it using

service mysqld start

Verifie also if the file /var/run/mysqld/mysqld.sock exist. Sometimes the socket is installed there or try to find the file mysqld.sock using these commands:

locate mysqld.sock

If this file exists then check the config file


and modifie the socket file config value to match the location of the mysqld.sock .

  • I created an Ubuntu droplet and I'm connection to it remotely in the meantime with mysql workbench, but I'm going to try what you mentioned and i'll let you know if it works tomorrow. I really want to get my native client working. Thanks for all of your help. – Miguel Coder Nov 29 '16 at 9:20
  • Oh by the way I cant upvote because I need 15 rep. – Miguel Coder Dec 14 '16 at 2:40
  • the solution worked ? – Dababi Dec 14 '16 at 7:16
  • I haven't checked, let me check right now. – Miguel Coder Dec 14 '16 at 8:00
  • I uninstalled mysql client. I'm using mysql workbench instead. – Miguel Coder Dec 14 '16 at 8:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.