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$
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$
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!!!
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