Ayaz Ahmad Tarar
Ayaz Ahmad Tarar

Reputation: 544

connect to local MySQL server

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$ 

Upvotes: 1

Views: 5591

Answers (2)

H.seongjun
H.seongjun

Reputation: 41

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

Upvotes: 0

N00b Pr0grammer
N00b Pr0grammer

Reputation: 4647

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

Upvotes: 2

Related Questions