Ruby on Rails 3 Can't connect to local MySQL server through socket '/tmp/mysql.sock' on OSX

前端 未结 14 1653
情深已故
情深已故 2020-11-27 09:30

I have a standard Rails3 environment, RVM 1.2.9, Rails 3.0.5, Ruby 1.9.2p180, MySQL2 Gem 0.2.7, mysql-5.5.10-osx10.6-x86_64

Error I get when running rake db:m

14条回答
  •  南笙
    南笙 (楼主)
    2020-11-27 10:17

    I have had the same problem, but none of the answers quite gave a step by step of what I needed to do. This error happens because your socket file has not been created yet. All you have to do is:

    1. Start you mysql server, so your /tmp/mysql.sock is created, to do that you run: mysql server start
    2. Once that is done, go to your app directory end edit the config/database.yml file and add/edit the socket: /tmp/mysql.sock entry
    3. Run rake:dbmigrate once again and everything should workout fine

提交回复
热议问题