`connect': Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) (Mysql2::Error)
问题描述:
当我尝试在远程服务器上运行 rails 时,我遇到了这个问题.
When I tried to run rails s on remote server I got this issue.
Mysql 与rails db"配合良好
Mysql working fine with "rails db"
答
使用
mysqladmin variables | grep socket
然后将套接字文件添加到您的 database.yml 配置中
And then add the socket file to your database.yml configuration
development:
adapter: mysql2
host: localhost
username: root
password: xxxx
database: xxxx
socket: <socket location>