Feb
27

使用XAMPP能够很方便的安装Apache环境,在使用Ruby on Rails连接MySql时会出现以以错误:

No such file or directory - /tmp/mysql.sock

原因是XAMPP的mysql.sock文件在以下路径:

/opt/lampp/var/mysql/mysql.sock

Ruby on Rails 按照默认的路径去找,就找不到。在XAMPP integration上提到的Patch方法已经不实用于Rails 1.1.6以后的版本,正确的修正方法是修改config/database.yml文件,如下:

development:
adapter: mysql
database: depot_development
username: root
password:
host: localhost
socket: /opt/lampp/var/mysql/mysql.sock

参考:Agile Web Development with Rails Page 72

Share and Enjoy:These icons link to social bookmarking sites where readers can share and discover new web pages.
  • del.icio.us
  • digg

Tags:

No Responses

Leave a Response

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>