How do I get pass the access denied error?

December 21, 2018 737 views
Ruby on Rails

How do I solve this error? I have mysql running but I am getting this error message on my Duelingpets website. Any advice on this?

Mysql2::Error
Access denied for user ‘root’@'localhost’
Extracted source (around line #90):

88
89
90
91
92
93

  conn_attrs = parse_connect_attrs(opts[:connect_attrs])

  connect user, pass, host, port, database, socket, flags, conn_attrs
end

def parse_ssl_mode(mode)

Rails.root: /home/rails/Duelingpets
Application Trace | Framework Trace | Full Trace

mysql2 (0.5.2) lib/mysql2/client.rb:90:in connect'
mysql2 (0.5.2) lib/mysql2/client.rb:90:in
initialize’
activerecord (5.2.2) lib/activerecord/connectionadapters/mysql2adapter.rb:22:in `new’
activerecord (5.2.2) lib/active
record/connectionadapters/mysql2adapter.rb:22:in mysql2_connection'
activerecord (5.2.2) lib/active_record/connection_adapters/abstract/connection_pool.rb:811:in
newconnection’
activerecord (5.2.2) lib/active
record/connectionadapters/abstract/connectionpool.rb:855:in checkout_new_connection'
activerecord (5.2.2) lib/active_record/connection_adapters/abstract/connection_pool.rb:834:in
trytocheckoutnewconnection’
activerecord (5.2.2) lib/activerecord/connectionadapters/abstract/connectionpool.rb:795:in `acquireconnection’
activerecord (5.2.2) lib/activerecord/connectionadapters/abstract/connectionpool.rb:523:in `checkout’
activerecord (5.2.2) lib/active
record/connectionadapters/abstract/connectionpool.rb:382:in connection'
activerecord (5.2.2) lib/active_record/connection_adapters/abstract/connection_pool.rb:1010:in
retrieveconnection’
activerecord (5.2.2) lib/active
record/connectionhandling.rb:118:in `retrieveconnection’
activerecord (5.2.2) lib/activerecord/connectionhandling.rb:90:in connection'
activerecord (5.2.2) lib/active_record/migration.rb:554:in
call’
actionpack (5.2.2) lib/actiondispatch/middleware/callbacks.rb:28:in `block in call’
activesupport (5.2.2) lib/active
support/callbacks.rb:98:in run_callbacks'
actionpack (5.2.2) lib/action_dispatch/middleware/callbacks.rb:26:in
call’
actionpack (5.2.2) lib/actiondispatch/middleware/executor.rb:14:in `call’
actionpack (5.2.2) lib/action
dispatch/middleware/debugexceptions.rb:61:in `call’
web-console (3.7.0) lib/web
console/middleware.rb:135:in call_app'
web-console (3.7.0) lib/web_console/middleware.rb:22:in
block in call’
web-console (3.7.0) lib/webconsole/middleware.rb:20:in `catch’
web-console (3.7.0) lib/web
console/middleware.rb:20:in call'
actionpack (5.2.2) lib/action_dispatch/middleware/show_exceptions.rb:33:in
call’
railties (5.2.2) lib/rails/rack/logger.rb:38:in call_app'
railties (5.2.2) lib/rails/rack/logger.rb:26:in
block in call’
activesupport (5.2.2) lib/activesupport/taggedlogging.rb:71:in block in tagged'
activesupport (5.2.2) lib/active_support/tagged_logging.rb:28:in
tagged’
activesupport (5.2.2) lib/activesupport/taggedlogging.rb:71:in tagged'
railties (5.2.2) lib/rails/rack/logger.rb:26:in
call’
sprockets-rails (3.2.1) lib/sprockets/rails/quietassets.rb:13:in `call’
actionpack (5.2.2) lib/action
dispatch/middleware/remoteip.rb:81:in `call’
actionpack (5.2.2) lib/action
dispatch/middleware/requestid.rb:27:in `call’
rack (2.0.6) lib/rack/method
override.rb:22:in call'
rack (2.0.6) lib/rack/runtime.rb:22:in
call’
activesupport (5.2.2) lib/activesupport/cache/strategy/localcachemiddleware.rb:29:in `call’
actionpack (5.2.2) lib/action
dispatch/middleware/executor.rb:14:in call'
actionpack (5.2.2) lib/action_dispatch/middleware/static.rb:127:in
call’
rack (2.0.6) lib/rack/sendfile.rb:111:in call'
railties (5.2.2) lib/rails/engine.rb:524:in
call’
puma (3.12.0) lib/puma/configuration.rb:225:in call'
puma (3.12.0) lib/puma/server.rb:658:in
handlerequest’
puma (3.12.0) lib/puma/server.rb:472:in `process
client’
puma (3.12.0) lib/puma/server.rb:332:in block in run'
puma (3.12.0) lib/puma/thread_pool.rb:133:in
block in spawn_thread’

Request

Parameters:

None

Toggle session dump
Toggle env dump
Response

Headers:

None

1 Answer

Hey friend,

This means that the MySQL credentials were rejected. Make sure that you have a solid set of tested credentials for it. Remember that the “root” user for the system is not the same as the “root” user for MySQL.

Jarland

  • How can the credentials be rejected even though I am using the same password for both the mysql root and the one to login into the server? I just don’t understand it.

Have another answer? Share your knowledge.