Skip to main content

[FIXED]: Can't connect to local MySQL server through socket '/tmp/mysql.sock' when running mysql database in docker, for a ruby on rails application

Change

host: localhost

to 

host: 127.0.0.1

in config/database.yml, to make the connection over TCP/IP rather than local socket.

You may also need to specify port 3306 explicitly.

https://cityad-all-prod.s3.amazonaws.com/public/2026-08/mysql%20logo%201.200x200-tiny.png
Please login to post comments: _TODO