I am using training software to learn Rails. I am using Windows 7 64bit with Service Pack 1 installed. I have MySQL Server 5.6 installed, along with MySQL Workbench 6.2 CE... if that makes a difference or not.
Right, so I building a content management system in the training and I am on "Accessing a Project" in the training software. I was told to start the server, which I did and everything is running fine. However, when visiting the site in Firefox, I received this error:
Mysql2::Error
Access denied for user 'root'@'localhost' (using password: YES)
Rails.root: E:/Programming/Rails/Sites/Simple_CMS Application Trace | Framework Trace | Full Trace
mysql2-0.3.18-x64 (mingw32) lib/mysql2/client.rb:70:in connect'
mysql2-0.3.18-x64 (mingw32) lib/mysql2/client.rb:70:ininitialize'
activerecord (4.2.0) lib/active_record/connection_adapters/mysql2_adapter.rb:18:in new'
activerecord (4.2.0) lib/active_record/connection_adapters/mysql2_adapter.rb:18:inmysql2_connection'
activerecord (4.2.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:436:in new_connection'
activerecord (4.2.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:446:incheckout_new_connection'
activerecord (4.2.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:422:in acquire_connection'
activerecord (4.2.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:349:inblock in checkout'
C:/Languages/Ruby/21-x64/lib/ruby/2.1.0/monitor.rb:211:in mon_synchronize'
activerecord (4.2.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:348:incheckout'
activerecord (4.2.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:263:in block in connection'
C:/Languages/Ruby/21-x64/lib/ruby/2.1.0/monitor.rb:211:inmon_synchronize'
activerecord (4.2.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:262:in connection'
activerecord (4.2.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:565:inretrieve_connection'
activerecord (4.2.0) lib/active_record/connection_handling.rb:113:in retrieve_connection'
activerecord (4.2.0) lib/active_record/connection_handling.rb:87:inconnection'
activerecord (4.2.0) lib/active_record/migration.rb:384:in connection'
activerecord (4.2.0) lib/active_record/migration.rb:371:incall'
actionpack (4.2.0) lib/action_dispatch/middleware/callbacks.rb:29:in block in call'
activesupport (4.2.0) lib/active_support/callbacks.rb:88:incall'
activesupport (4.2.0) lib/active_support/callbacks.rb:88:in _run_callbacks'
activesupport (4.2.0) lib/active_support/callbacks.rb:734:in_run_call_callbacks'
activesupport (4.2.0) lib/active_support/callbacks.rb:81:in run_callbacks'
actionpack (4.2.0) lib/action_dispatch/middleware/callbacks.rb:27:incall'
actionpack (4.2.0) lib/action_dispatch/middleware/reloader.rb:73:in call'
actionpack (4.2.0) lib/action_dispatch/middleware/remote_ip.rb:78:incall'
actionpack (4.2.0) lib/action_dispatch/middleware/debug_exceptions.rb:17:in call'
web-console (2.1.1) lib/web_console/middleware.rb:37:incall'
actionpack (4.2.0) lib/action_dispatch/middleware/show_exceptions.rb:30:in call'
railties (4.2.0) lib/rails/rack/logger.rb:38:incall_app'
railties (4.2.0) lib/rails/rack/logger.rb:20:in block in call'
activesupport (4.2.0) lib/active_support/tagged_logging.rb:68:inblock in tagged'
activesupport (4.2.0) lib/active_support/tagged_logging.rb:26:in tagged'
activesupport (4.2.0) lib/active_support/tagged_logging.rb:68:intagged'
railties (4.2.0) lib/rails/rack/logger.rb:20:in call'
actionpack (4.2.0) lib/action_dispatch/middleware/request_id.rb:21:incall'
rack (1.6.0) lib/rack/methodoverride.rb:22:in call'
rack (1.6.0) lib/rack/runtime.rb:18:incall'
activesupport (4.2.0) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in call'
rack (1.6.0) lib/rack/lock.rb:17:incall'
actionpack (4.2.0) lib/action_dispatch/middleware/static.rb:113:in call'
rack (1.6.0) lib/rack/sendfile.rb:113:incall'
railties (4.2.0) lib/rails/engine.rb:518:in call'
railties (4.2.0) lib/rails/application.rb:164:incall'
rack (1.6.0) lib/rack/lock.rb:17:in call'
rack (1.6.0) lib/rack/content_length.rb:15:incall'
rack (1.6.0) lib/rack/handler/webrick.rb:89:in service'
C:/Languages/Ruby/21-x64/lib/ruby/2.1.0/webrick/httpserver.rb:138:inservice'
C:/Languages/Ruby/21-x64/lib/ruby/2.1.0/webrick/httpserver.rb:94:in run'
C:/Languages/Ruby/21-x64/lib/ruby/2.1.0/webrick/server.rb:295:inblock in start_thread'
Request
GATEWAY_INTERFACE: "CGI/1.1"
HTTP_ACCEPT: "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
HTTP_ACCEPT_ENCODING: "gzip, deflate"
HTTP_ACCEPT_LANGUAGE: "en-GB,en;q=0.5"
REMOTE_ADDR: "::1"
REMOTE_HOST: "::1"
SERVER_NAME: "localhost"
SERVER_PROTOCOL: "HTTP/1.1"
Okay, so reading the previous answers, it appears that I have a password error. At first, I couldn't remember the password I assigned so I looked on here for ways to change it. I thought I changed it but apparently I did not. When I added the password to database.yml file, I still get the same error.
Frustrated, I looked at another forum post similar to this one and found I have to use the code:
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('somepassword')
Well, that isn't working. Maybe I lack the permissions, but I thought root access gave you administrative privileges.