I installed a docker image for mysql.
docker run --name mysql -d -p 3306:3306 -e MYSQL_ROOT_PASSWORD="Foo" -e DB_REMOTE_ROOT_NAME=root -e DB_REMOTE_ROOT_PASS="foo" -e DB_USER=foo -e DB_PASS="foo" -e DB_NAME=foo -v /:/host -v /home/user1/data/mysql:/var/lib/mysql mysql:latest
Everything is fine, and I can connect to mysql in two ways.
docker exec -it mysql bash
mysql -ufoo -pfoo foo
and from my Mac console (without docker exec -it)
mysql -ufoo -pfoo -h0.0.0.0 foo
The problem that I see is that the second approach takes a lot of time. It connects successfully, but there is a delay of 15 to 20 seconds.
whereas in docker exec it instantly connects.
why is there a delay when I connect to my mac terminal directly using mysql and not the first SSH in the field?
I tried replacing 0.0.0.0 with localhost. but then i get an error
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
Edit ::
I tried the following and nothing really works
mysql -ufoo -pbar -h1x.1x.5x.14x foo
mysql -ufoo -pbar -h127.0.0.1 foo
mysql -ufoo -pbar -hmysql.local foo
all of the above 3 have a delay of 10 seconds
But if I do
docker exec -it mysql bash
mysql -ufoo -pbar foo
it's instant without delay