TIL — ‘/tmp/mysql.sock’ (2) Error, Docker For Mac is Unusable

1. Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (2)

I have a Docker with MySQL image running, but when I try to connect to it using mysql -u root -p, I got this response :

Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (2)

Turn out by default MySQL using socket to establish a connection, while with Docker we need a tcp connection. So, instead of using previous command, I use this and it works flawlessly

mysql -u root -p -h localhost -P 3306 --protocol=tcp

ㅤㅤㅤ

2. Docker for Mac is not usable today. Don’t use it.

It consume more than 100% of my CPU. Performing docker ps, docker info, etc always end up with operation timeout error. I’ve following many suggestions, one of them is to lower the CPUs used for docker. It works, but not so long until Docker eat up my CPU again.

At least three PR still open and hot, complaining about high CPU usage. One of them give me a glimpse what actually happened :

Quick benchmarks showed that hypervisor used by docker is slower (in terms of IO and CPU) than other alternatives, like virtualbox, parallels or vmware.