0

I install on my MacOS Sierra long time ago MySQL using brew install mysql and everytime I turn off and on my computer mysql started automagicaly what was great. But unfortunately yesterday I needed to temporarily shutdown MySQL - so I found on internet some command (but it was not brew services stop mysql) and after that when I reboot my computer MySQL not started (I was unable to connect by Sequel Pro GUI MySQL client). So I try to run it by:

brew services start mysql
==> Successfully started `mysql` (label: homebrew.mxcl.mysql)

But I was still unable to connect :(

Kamil Kiełczewski
  • 85,173
  • 29
  • 368
  • 345
  • 1
    Possible duplicate of [Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)](https://stackoverflow.com/questions/4448467/cant-connect-to-local-mysql-server-through-socket-var-lib-mysql-mysql-sock) – naXa stands with Ukraine Jun 24 '17 at 11:47
  • @naXa no because in my question the problem reason was db shutdown not by `brew service stop mysql` - after looong investigation I find out that there is a problem with `mysql.sock`. So value of question formulated in this way is to protect people against loosing time to find the problem reason (which is not trivial as you can see on my answer (knowing to use 'mysqladmin' as middle step to find solution )) – Kamil Kiełczewski Jun 24 '17 at 12:05

1 Answers1

-1

I try to connect by following command (to change root password) and get hint:

Mac-mini-Kamil:local Kamil$ mysqladmin -u root password 'xxxx'
mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)'
Check that mysqld is running and that the socket: '/tmp/mysql.sock' exists!

I type this 'hint' to internet and find out that I need run the following command:

mysqld

And that works :) (I was able to connect to my db)

Kamil Kiełczewski
  • 85,173
  • 29
  • 368
  • 345
  • I'm having the same problem and it isn't the first time and always ended up having to re-install everything again. This week was all working until this morning the problem happened again. I did ```mysqld``` and still not working. – Pablo Oct 19 '17 at 10:34
  • this problem is probably more complicated that it suppose to be. How ever there is also some alternative: **use docker with mysql image** – Kamil Kiełczewski Oct 19 '17 at 12:39