-1

I have mounted the mysql socket into the container using:

-v /var/run/mysqld/mysqld.sock:/tmp/mysql.sock

But I get this error:

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

nwinkler
  • 52,665
  • 21
  • 154
  • 168

1 Answers1

-1

If you're trying to connect inside the container, you need to connect to /tmp/mysql.sock though right...? (as that's where it's mounted to) You need to configure your client to connect to /tmp/mysql.sock.

Check out this SO Answer for more info on that.

Community
  • 1
  • 1
johnharris85
  • 17,264
  • 5
  • 48
  • 52
  • thanks for your swift response. I've tried editing the my.conf file in docker container but still getting the same error. – Nemitari Ajienka Nov 03 '16 at 01:53
  • I tried another method which worked. Granted remote access and privileges to mysql server for a new user via host IP address – Nemitari Ajienka Nov 03 '16 at 02:30
  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - [From Review](/review/low-quality-posts/14176826) – Mike Nov 03 '16 at 17:55
  • @Mike, the link does not (and is not intended to) answer the question, it is supporting information around the actual answer (OP is trying to connect to the wrong thing). Although I appreciate you leaving a comment after downvoting (assuming it was you). – johnharris85 Nov 03 '16 at 17:56
  • @johnharris85 I didn't downvote. I merely voted this on [this review task](http://stackoverflow.com/review/low-quality-posts/14176826) as your answer was flagged automatically by the system as low quality. It will need several votes to be deleted, so if others disagree with me as well, you have nothing to worry about. – Mike Nov 03 '16 at 17:59
  • Fair enough, then I definitely don't appreciate the person who down-voted without commenting ;) – johnharris85 Nov 03 '16 at 18:00
  • @johnharris85 With that said, if the answer is an exact copy of something elsewhere, it is more appropriate to flag the question as a duplicate instead of posting an answer that just links to the other answer. – Mike Nov 03 '16 at 18:01
  • *"I definitely don't appreciate the person who down-voted without commenting"* - Ha! I hate that too, but you're going to have to get used to it around here. – Mike Nov 03 '16 at 18:01
  • Thanks @johnharris85 .I figured I needed to use --net=host docker option this only works on linux and not mac. http://nkhare.github.io/data_and_network_containers/networking/ – Nemitari Ajienka Nov 08 '16 at 21:54