[英]Rails 3.2 - Can't connect to local MySQL
When I run the app, I will get this error message: 当我运行该应用程序时,我将收到以下错误消息:
/Users/adam/.rvm/gems/ruby-1.9.3-p385/gems/mysql2-0.3.11/lib/mysql2/client.rb:44:in `connect': Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) (Mysql2::Error)
If I try to run 如果我尝试跑步
mysqladmin variables | grep socket
The result is: 结果是:
mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)'
I am pretty sure I was working with Rails 3.2 and MySQL, but now it doesn't. 我很确定我正在使用Rails 3.2和MySQL,但是现在不行了。 I am running on Mac OS Lion, could you help me please what am I missing?
我在Mac OS Lion上运行,您能帮我些什么吗?
Thank you 谢谢
Type ps aux | grep mysqld
键入
ps aux | grep mysqld
ps aux | grep mysqld
in the terminal and see if anything shows up besides the grep command. 在终端中使用
ps aux | grep mysqld
,查看是否除了grep命令外还显示任何内容。 If not, you're mysql server isn't running. 如果不是,则说明您的mysql服务器未运行。 Otherwise try typing
mysqld start
in the terminal and see if you can't get your sql server to boot up. 否则,请尝试在终端中键入
mysqld start
,看看是否无法启动sql服务器。
Edit: Sorry, on OSX the command to start it should be mysql.server start
编辑:对不起,在OSX上启动它的命令应该是
mysql.server start
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.