user984621
user984621

Reputation: 48453

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. I am running on Mac OS Lion, could you help me please what am I missing?

Thank you

Upvotes: 1

Views: 598

Answers (1)

JoshEmory
JoshEmory

Reputation: 644

Type ps aux | grep mysqld in the terminal and see if anything shows up besides the grep command. If not, you're mysql server isn't running. Otherwise try typing mysqld start in the terminal and see if you can't get your sql server to boot up.

Edit: Sorry, on OSX the command to start it should be mysql.server start

Upvotes: 2

Related Questions