rails-chat-tutorial icon indicating copy to clipboard operation
rails-chat-tutorial copied to clipboard

Unable to connect to mysql

Open swzensar8 opened this issue 6 years ago • 1 comments
trafficstars

Hello Iridakos,

Thanks for your post on dockerising rails application. I followed steps in that post but I am using MySql DB and its giving following error bin/rails: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2 "No such file or directory") (Mysql2::Error)

I googled to fix it but nothing worked for me. My docker command is: docker run --net=my_isolated_bridge_network --name demo-web --link mysql01
-e DATABASE_HOST=localhost
-e DATABASE_PORT=33060
-e DATABASE_USERNAME=root
-e DATABASE_PASSWORD='YN0N!omijwUpuMytDyPARK0hAz5'
-e DATABASE_SOCKET=/var/run/mysqld/mysqld.sock
-e REDIS_URL=redis://172.17.0.1:6380/1
-p 3000:3000
demo

I tried to use --link option to communicate two container and also putted in same network also. Yes we can do it using docker-compose but is it possible without using docker-compose. Please help. Thanks in advance.

swzensar8 avatar Jul 24 '19 19:07 swzensar8

Hi @swzensar8 and sorry for the delayed response. Do you still have the issue?

iridakos avatar May 01 '20 00:05 iridakos