I have git cloned a repository in order to start contributing to a private project.
Now when I start the mysql server as well as the rails server I get the following error:
Access denied for user 'root'@'localhost' (using password: YES) (Mysql2::Error)
Now I tried to login with the password that I found in the config/database.yml file but without success. What should I do to have the app run properly in my local environment?
Thanks for helping out.
the database.yml file:
development:
adapter: mysql2
encoding: utf8
reconnect: false
database: sc_development
pool: 5
username: root
password: Mysql2047
socket: /tmp/mysql.sock
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
adapter: mysql2
encoding: utf8
reconnect: false
database: sc_test
pool: 5
username: root
password: Mysql2047
socket: /tmp/mysql.sock
This was doing the trick for me:
First, instead of logging into mysql with
mysqllogin like this:
mysql -urootroot@localhost has all rights and NO password.
Next, I created the database and another user who I gave all rights.
mysql> CREATE USER joe identified by 'foobar'mysql> Grant All PRIVILEGES ON smartcheckups_development.* TO joe;Create the database:
mysql> CREATE DATABASE sc_development;In my database.yml file, I updated the login & password with that of the above user joe. This will allow me to login.
Leave mysql via
\qThen
bundle exec rake db:createand start rails
rails s