(It\'s probably a dumb question due to my limited knowledge with Docker or mysql administration, but since I spent a whole evening on this issue, I dare to ask it.)
The simple method is to share the mysql unix socket to host machine. Then connect through the socket
Steps:
mkdir /hostdocker run -it -v /host:/shared ./etc/my.cnf and change socket entry in the file to socket=/shared/mysql.sockservice mysql restart in dockermysql -u root --socket=/host/mysql.sock. If password use -p option