0

I'm using mysql2 gem on rails 5. Also I use AWS Cloud9 EC2 instance for development if that helps.

Here is error I'm getting:

$ RAILS_ENV=development bundle exec rake db:setup 

rake aborted! 
Mysql2::Error::ConnectionError: 
Can't connect to local MySQL server through socket '/var/mysql/mysql.sock' (2)

Here is my database.yml file:

development:
  adapter: mysql2
  socket: /var/mysql/mysql.sock
  database: wagn_development
  username: user
  password: user
  host: localhost

test:
  adapter: mysql2
  socket: /var/mysql/mysql.sock
  database: wagn_test
  username: user
  password: user
  host: localhost

production:
  adapter: mysql2
  socket: /var/mysql/mysql.sock
  database: wagn_production
  username: user
  password: user
  host: localhost

How to solve the error?

DanielsV
  • 892
  • 1
  • 8
  • 26

1 Answers1

0

I believe this is not about Rails.

Are you using RDS or the DB is at same machine?

Have you read this or tryed any of thoses? I believe this is releated

Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

Fábio Araújo
  • 495
  • 8
  • 11