0

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.

1
  • The MySQL command line? Hmm, have been trying to change my password from the command prompt. I will try again... Hmm, seems they want a password the moment I click into the MySQL 5.6 Command Line Client. Is there a file I can look at to see what the root password is? If not, what is the procedure for resetting the root password? Commented Mar 11, 2015 at 0:49

1 Answer 1

0

You need to follow the steps Here in order to reset the root password. There are number of steps. If it was me and there is nothing that cannot be redone or recovered from a backup on mysql, I would just reinstall from scratch with a fresh root password that I wont forget.

Sign up to request clarification or add additional context in comments.

2 Comments

I literally just got finished doing that. Here is the message I received: 2015-03-10 21:10:37 0 [Warning] TIMESTAMP with implicit DEFAULT value is depreciated. Please use --explicit_defaults_for_timestamp server option (see documentation for more defaults). I know you want me to take the easy way out and just reinstall but if I do not learn to handle these situations now, then when I start working for a larger organization, I will be up the creek without a paddle. I am sure "just reinstalling MySQL" will not fly well in a major organization
I don't have a backup, but fine. I guess I can keep reinstalling everything whenever I have a problem...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.