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

前端 未结 14 1639
情深已故
情深已故 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:18

    If you are on Mac OSX,

    The default location for the MySQL Unix socket is different on Mac OS X and Mac OS X Server depending on the installation type you chose

    MySQL Unix Socket Locations on Mac OS X by Installation Type

    • Package Installer from MySQL ------------------/tmp/mysql.sock

    • Tarball from MySQL -------------------------------/tmp/mysql.sock

    • MySQL Bundled with Mac OS X Server -------/var/mysql/mysql.sock

    So just change your database.yml in socket: /tmp/mysql.sock to point to the right place depending on what OS and installation type you are using

提交回复
热议问题