moduxiaohunhun / self-study-record

0 stars 0 forks source link

docker: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) #15

Open moduxiaohunhun opened 1 year ago

moduxiaohunhun commented 1 year ago

如果没有指定协议或主机参数,mysql clinet会使用unix socket协议作为默认协议值来连接mysql服务器,但mysql docker容器是在tcp socket上监听的

https://juejin.cn/post/7159491422758895630

https://stackoverflow.com/questions/23234379/installing-mysql-in-docker-fails-with-error-message-cant-connect-to-local-mysq