title: How to db:setup mysql2 database?
body: <p>I'm using mysql2 gem on rails 5. Also I use AWS Cloud9 EC2 instance for development if that helps.</p>
  
  <p>Here is error I'm getting:</p>
  
  <pre><code>$ 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)
  </code></pre>
  
  <p>Here is my database.yml file:</p>
  
  <pre><code>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
  </code></pre>
  
  <p>How to solve the error?</p>