No such file or directory - /tmp/mysql.sock
来源:互联网 发布:索引超出矩阵维度 编辑:程序博客网 时间:2024/05/22 03:44
转自: http://hi.baidu.com/royalchy/blog/item/591aac595a2b562f2834f059.html
So you installed Ubuntu, got all excited about developing your Rails application on it, and then…
No such file or directory - /tmp/mysql.sock)
No matter what you do, database connection doesn’t work. Youreinstall Rails (of course you installed it via “sudo apt-get rails”,right??), reinstall MySql, recreate the database schema, change root’spassword, install Kubuntu instead of Ubuntu… But it doesn’t work.
The reason for this error is quite simple, really: somewhere alongRuby’s Mysql driver, mysql socket is expected to exist at/tmp/mysql.sock. But that’s not where it is in Ubuntu. If you take sometime searching, you’ll notice that the .sock file is actually on/var/run/mysqld - and it’s called mysqld.sock instead.
In fact, if you Google it, there is a closed bug entry on Rails’ tracking systemregarding that problem, and the suggested solution there is to changeyour database.yml to add a link to the correct socket. Something like:
production:
adapter: mysql
socket: /var/run/mysqld/mysqld.sock
Which is obviously not a good idea, since you’ll end up creating newprojects, moving to a different OS or whatever - and everything willbreak again.
So I tried a small patchwork to fool mysql’s driver, and then it works nicely:
sudo ln -s /var/run/mysqld/mysqld.sock /tmp/mysql.sock
That way you will actually HAVE a /tmp/mysql.sock file, as expectedby mysql driver, and everything will connect just fine. Just like it’smeant to be. Amen!
- No such file or directory - /tmp/mysql.sock
- redmine安装时 No such file or directory /tmp/mysql.sock
- rails 提示Errno::ENOENT: No such file or directory - /tmp/mysql.sock的解决方法
- /var/run/libvirt/virtlogd-sock': No such file or directory
- mysql.h: No such file or directory
- No such file or directory
- No such file or directory
- No such file or directory
- no such file or directory
- ovs-vsctl: unix:/var/run/openvswitch/db.sock: database connection failed (No such file or directory)
- Can't open /tmp/extman//sid_b2045a90ebc1b352de0a3c08e41cab9b, No such file or directory
- Unable to Open 'C:\windows\system32\odbcconf.tmp' No such file or directory
- stopping hbasecat: /tmp/hbase-root-master.pid: No such file or directory
- stopping hbasecat: /tmp/hbase-root-master.pid: No such file or directory
- 安装mysql错误 gcc: @ndbcluster_includes@: No such file or directory
- fatal error: mysql.h: No such file or directory
- No such file or directory -- MYSQL 二进制版本启动失败
- php mysql No such file or directory[2002]
- av_read_frame_internal
- jQuery.js中继承的实现
- 使用to_date创建函数索引的时候经常会遇到ORA-01743错误
- [转贴]C/C++内存泄露及其检测工具
- 带有模板参数的函数指针
- No such file or directory - /tmp/mysql.sock
- 勉励
- 建立链接服务器
- Global.asax 介绍
- Axure RP Pro - jQuery - 如何在Axure RP Pro生成的HTML原型文档中使用自定义脚本
- .NET开发资源站点和部分优秀.NET开源项目
- 在ASP.NET中实现Url Rewriting
- Webkit Painting and Event Flow 绘屏和事件 探讨
- SSH Communications Security【强大的工具,附带可视化scp功能】