0

I run two containers in a pod: one is based on debian:wheezy, the other one is mysql:5.6.

When I log into the 2nd container, I can invoke the MySQL client mysql without problems.

When I log into the 1st container and invoke the MySQL client mysql (after apt-get install -y mysql-client), I get this error message:

ERROR 2002 (HY000): 
Can't connect to local MySQL server through socket 
'/var/run/mysqld/mysqld.sock' (2)

I assume this is because the two containers use their own file systems, and the socket exists only in the 2nd one's.

Is there a simple way for getting the MySQL client to work in the 1st container while the MySQL server runs in the 2nd and still using sockets?

Drux
  • 646
  • 1
  • 8
  • 23

1 Answers1

0

The solution consists of invoking the MySQL client in the 2nd container like this:

mysql -host 127.0.0.1

This will force the client to make a TCP/IP connection instead of using a Unix socket file. (localhost would not do in this case.)

Drux
  • 646
  • 1
  • 8
  • 23