I am new to Rails. I tried a lot to solve my problem with the answers given on this site, but could not.
1.My configurations
Window 7 64bit
ruby 1.9.3p484
rails 4.0.2
mysql server 5.0.91-community-nt (32bit)
mysql gem
I set a password for root in mysql configuration
2. I created a new application
rails new my_cms -d mysql
I made two changes
1. Inside the Gemfile, I use mysql instead of mysql2
2. Inside config / database.yml I use mysql instead of mysql2
3.config / database.yml
development:
adapter: mysql
encoding: utf8
database: mycms_development
pool: 5
username: root
password:
host: 127.0.0.1
port: 3306
test:
adapter: mysql2
encoding: utf8
database: mycms_test
pool: 5
username: root
password:
host: localhost
production:
adapter: mysql2
encoding: utf8
database: mycms_production
pool: 5
username: root
password:
host: localhost
4.Running
rails s
server server is running.
5.Open the browser and enter localhost:3000 ERROR as shown below
Mysql::Error
Access denied for user 'root'@'localhost' (using password: NO)
Rails.root: E:/cms/mycms
6. My efforts to fix the error
I tried my best to crack the error, like here. TRY => changed 127.0.0.1 instead of localhost, added port: 3306
RESULT => Mysql::Error
Access denied for user 'root'@'localhost' (using password: NO)
Rails.root: E:/cms/mycms
TRY = > config/database.yml
= > ActiveRecord::ConnectionNotEstablished
TRY = > mysql -uroot
= > ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
TRY = > vipin mysql -uvipin
= > ERROR 1045 (28000): Access denied for user 'vipin'@'localhost' (using password: NO)
TRY = > mysql -uroot -p
= > password:, , mysql > .
, . .
localhost:3000
