When i run rake test for default test file i get the access denied error even though i have provided password in my database.yml file. What might be the problem? This is my yml file. My error in terminal
default: &default
adapter: mysql2
encoding: utf8
pool: 5
username: root
password: Mysql1234
host: 127.0.0.1
test:
<<: *default
database: rails_test
Edited: I think the problem is that it is saying there is no password(PASSWORD NO) given even though i gave one. My mysql is working fine only in rails there is a problem My user table in mysql
If database.yml isn't working , then maybe u should check for a .env file . Some things you can do to make sure that the database.yml file is coorect - following is what a default syntax looks like
default: &default
adapter: mysql2
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
timeout: 5000
username:
password:
host: localhost
# development:
# <<: *default
# database: db/development.sqlite3
development:
adapter: mysql2
encoding: utf8
database:
username:
password:
host: localhost
port: 3306
# 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:
<<: *default
adapter: mysql2
encoding: utf8
database:
username:
password:
host: localhost
port: 3306
production:
adapter: mysql2
encoding: utf8
pool: 10
database:
username:
password:
host: localhost
port: 3306