1

I am using MAC OS Sierra . and trying to access mysql but getting error like

UserXs-MacBook-Pro:~ Ayaz$ mysql -u root
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
UserXs-MacBook-Pro:~ Ayaz$ 
Ayaz Ahmad Tarar
  • 534
  • 8
  • 24

2 Answers2

2

If you have your MySQL UP and running, you could try the following step to get your issue sorted out!

This worked for me and hope works for you too!

sudo /usr/local/mysql/support-files/mysql.server start

This is an interesting question on SO which is on a similar discussion, hope that this helps!!!

Community
  • 1
  • 1
N00b Pr0grammer
  • 4,503
  • 5
  • 32
  • 46
0

Check this. I wasn't running MySQL Server. Run server first.

$ mysql.server start
$ mysql -h localhost -u root -p your_password

if you install at Mac os. There is no password

$ mysql -h localhost -u root -p
H.seongjun
  • 41
  • 6