title: Mysql2::Error - Access denied for user 'root'@'localhost' (using password: YES)
body: <p>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.</p>
  
  <p>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:</p>
  
  <hr>
  
  <p>Mysql2::Error</p>
  
  <p>Access denied for user 'root'@'localhost' (using password: YES)</p>
  
  <p>Rails.root: E:/Programming/Rails/Sites/Simple_CMS
  Application Trace | Framework Trace | Full Trace</p>
  
  <p>mysql2-0.3.18-x64 (mingw32) lib/mysql2/client.rb:70:in <code>connect'
  mysql2-0.3.18-x64 (mingw32) lib/mysql2/client.rb:70:in</code>initialize'
  activerecord (4.2.0) lib/active_record/connection_adapters/mysql2_adapter.rb:18:in <code>new'
  activerecord (4.2.0) lib/active_record/connection_adapters/mysql2_adapter.rb:18:in</code>mysql2_connection'
  activerecord (4.2.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:436:in <code>new_connection'
  activerecord (4.2.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:446:in</code>checkout_new_connection'
  activerecord (4.2.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:422:in <code>acquire_connection'
  activerecord (4.2.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:349:in</code>block in checkout'
  C:/Languages/Ruby/21-x64/lib/ruby/2.1.0/monitor.rb:211:in <code>mon_synchronize'
  activerecord (4.2.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:348:in</code>checkout'
  activerecord (4.2.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:263:in <code>block in connection'
  C:/Languages/Ruby/21-x64/lib/ruby/2.1.0/monitor.rb:211:in</code>mon_synchronize'
  activerecord (4.2.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:262:in <code>connection'
  activerecord (4.2.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:565:in</code>retrieve_connection'
  activerecord (4.2.0) lib/active_record/connection_handling.rb:113:in <code>retrieve_connection'
  activerecord (4.2.0) lib/active_record/connection_handling.rb:87:in</code>connection'
  activerecord (4.2.0) lib/active_record/migration.rb:384:in <code>connection'
  activerecord (4.2.0) lib/active_record/migration.rb:371:in</code>call'
  actionpack (4.2.0) lib/action_dispatch/middleware/callbacks.rb:29:in <code>block in call'
  activesupport (4.2.0) lib/active_support/callbacks.rb:88:in</code>call'
  activesupport (4.2.0) lib/active_support/callbacks.rb:88:in <code>_run_callbacks'
  activesupport (4.2.0) lib/active_support/callbacks.rb:734:in</code>_run_call_callbacks'
  activesupport (4.2.0) lib/active_support/callbacks.rb:81:in <code>run_callbacks'
  actionpack (4.2.0) lib/action_dispatch/middleware/callbacks.rb:27:in</code>call'
  actionpack (4.2.0) lib/action_dispatch/middleware/reloader.rb:73:in <code>call'
  actionpack (4.2.0) lib/action_dispatch/middleware/remote_ip.rb:78:in</code>call'
  actionpack (4.2.0) lib/action_dispatch/middleware/debug_exceptions.rb:17:in <code>call'
  web-console (2.1.1) lib/web_console/middleware.rb:37:in</code>call'
  actionpack (4.2.0) lib/action_dispatch/middleware/show_exceptions.rb:30:in <code>call'
  railties (4.2.0) lib/rails/rack/logger.rb:38:in</code>call_app'
  railties (4.2.0) lib/rails/rack/logger.rb:20:in <code>block in call'
  activesupport (4.2.0) lib/active_support/tagged_logging.rb:68:in</code>block in tagged'
  activesupport (4.2.0) lib/active_support/tagged_logging.rb:26:in <code>tagged'
  activesupport (4.2.0) lib/active_support/tagged_logging.rb:68:in</code>tagged'
  railties (4.2.0) lib/rails/rack/logger.rb:20:in <code>call'
  actionpack (4.2.0) lib/action_dispatch/middleware/request_id.rb:21:in</code>call'
  rack (1.6.0) lib/rack/methodoverride.rb:22:in <code>call'
  rack (1.6.0) lib/rack/runtime.rb:18:in</code>call'
  activesupport (4.2.0) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in <code>call'
  rack (1.6.0) lib/rack/lock.rb:17:in</code>call'
  actionpack (4.2.0) lib/action_dispatch/middleware/static.rb:113:in <code>call'
  rack (1.6.0) lib/rack/sendfile.rb:113:in</code>call'
  railties (4.2.0) lib/rails/engine.rb:518:in <code>call'
  railties (4.2.0) lib/rails/application.rb:164:in</code>call'
  rack (1.6.0) lib/rack/lock.rb:17:in <code>call'
  rack (1.6.0) lib/rack/content_length.rb:15:in</code>call'
  rack (1.6.0) lib/rack/handler/webrick.rb:89:in <code>service'
  C:/Languages/Ruby/21-x64/lib/ruby/2.1.0/webrick/httpserver.rb:138:in</code>service'
  C:/Languages/Ruby/21-x64/lib/ruby/2.1.0/webrick/httpserver.rb:94:in <code>run'
  C:/Languages/Ruby/21-x64/lib/ruby/2.1.0/webrick/server.rb:295:in</code>block in start_thread'</p>
  
  <p>Request</p>
  
  <pre><code>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"
  </code></pre>
  
  <hr>
  
  <p>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.</p>
  
  <p>Frustrated, I looked at another forum post similar to this one and found I have to use the code:</p>
  
  <pre><code>SET PASSWORD FOR 'root'@'localhost' = PASSWORD('somepassword')
  </code></pre>
  
  <p>Well, that isn't working. Maybe I lack the permissions, but I thought root access gave you administrative privileges. </p>