Access denied for user 'root'@'localhost' (using password: YES) even though i have added in mysql

Hi,

I am getting the error “Access denied for user ‘root’@‘localhost’ (using
password: YES)” in my application. I have granted full permissions for
the device in mysql.

My applications runs perfectly fine. But if i keep the browser idle for
some time and then try to load the page I get the above error. When I do
ctrl + F5 few times the app is up and running. After some time I get the
error “Lost connection to MySQL server during query”.

Why am I getting such an error? The same code with the same DB is
running fine in another system.

Any help is appreciated.

Regards,
Madhu.

On Tue, Jan 3, 2012 at 1:30 PM, Madhusudhan H R
[email protected]wrote:

Why am I getting such an error? The same code with the same DB is
running fine in another system.

Any help is appreciated.

Could you show:

Operating system on which the server is running?
Which Rails version?
Is that database on the same server, same user, different server?
(I presume you are going over TCP/IP ?)
Content of config/database.yml (hide the password !).
Do you see an error trace in your log file (grep for FATAL or ‘500’)

Thanks,

Peter


Peter V.
http://twitter.com/peter_v
http://rails.vandenabeele.com

I am running it on windows 2003 VM.
Rails versions in 2.3.5. Database is in another server not the same
server.

Here is the database.yml conf

development:
adapter: mysql
encoding: utf8
database: db
username: root
password: ***
host: 172.16.1.50
port: 3306

Yes the request is through TCP/IP.

Below is the error trace:

/!\ FAILSAFE /!\ Tue Jan 03 18:38:51 +0530 2012
Status: 500 Internal Server Error
Lost connection to MySQL server during query
c:/Ruby187/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapte
rs/mysql_adapter.rb:597:in real_connect' c:/Ruby187/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapte rs/mysql_adapter.rb:597:inconnect’
c:/Ruby187/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapte
rs/mysql_adapter.rb:203:in initialize' c:/Ruby187/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapte rs/mysql_adapter.rb:75:innew’
c:/Ruby187/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapte
rs/mysql_adapter.rb:75:in mysql_connection' c:/Ruby187/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapte rs/abstract/connection_pool.rb:223:insend’
c:/Ruby187/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapte
rs/abstract/connection_pool.rb:223:in new_connection' c:/Ruby187/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapte rs/abstract/connection_pool.rb:245:incheckout_new_connection’
c:/Ruby187/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapte
rs/abstract/connection_pool.rb:188:in checkout' c:/Ruby187/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapte rs/abstract/connection_pool.rb:184:inloop’
c:/Ruby187/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapte
rs/abstract/connection_pool.rb:184:in checkout' c:/Ruby187/lib/ruby/1.8/monitor.rb:242:insynchronize’
c:/Ruby187/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapte
rs/abstract/connection_pool.rb:183:in checkout' c:/Ruby187/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapte rs/abstract/connection_pool.rb:98:inconnection’
c:/Ruby187/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapte
rs/abstract/connection_pool.rb:326:in retrieve_connection' c:/Ruby187/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapte rs/abstract/connection_specification.rb:123:inretrieve_connection’
c:/Ruby187/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapte
rs/abstract/connection_specification.rb:115:in connection' c:/Ruby187/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/query_cache.rb:9: incache’
c:/Ruby187/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/query_cache.rb:28
:in call' c:/Ruby187/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapte rs/abstract/connection_pool.rb:361:incall’
c:/Ruby187/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/string_coercion
.rb:25:in call' c:/Ruby187/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/head.rb:9:incall’
c:/Ruby187/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/methodoverride.rb:24:in
call' c:/Ruby187/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/params_parser.r b:15:incall’
c:/Ruby187/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/session/cookie_
store.rb:93:in call' c:/Ruby187/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/failsafe.rb:26: incall’
c:/Ruby187/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/lock.rb:11:in
call' c:/Ruby187/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/lock.rb:11:insynchronize’
c:/Ruby187/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/lock.rb:11:in
call' c:/Ruby187/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/dispatcher.rb:1 14:incall’
c:/Ruby187/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/reloader.rb:34:
in run' c:/Ruby187/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/dispatcher.rb:1 08:incall’
c:/Ruby187/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails/rack/static.rb:31:in
call' c:/Ruby187/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/urlmap.rb:46:incall’
c:/Ruby187/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/urlmap.rb:40:in
each' c:/Ruby187/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/urlmap.rb:40:incall’
c:/Ruby187/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails/rack/log_tailer.rb:17:in
call' c:/Ruby187/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/content_length.rb:13:incall’
c:/Ruby187/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/chunked.rb:15:in
call' c:/Ruby187/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/handler/mongrel.rb:64:inprocess’

c:/Ruby187/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mingw32/lib/mongrel.rb:159:in 

proce ss_client' c:/Ruby187/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mingw32/lib/mongrel.rb:158:ineach’

c:/Ruby187/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mingw32/lib/mongrel.rb:158:in 

proce ss_client' c:/Ruby187/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mingw32/lib/mongrel.rb:285:inrun’
c:/Ruby187/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mingw32/lib/mongrel.rb:285:in
initi alize' c:/Ruby187/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mingw32/lib/mongrel.rb:285:innew’
c:/Ruby187/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mingw32/lib/mongrel.rb:285:in
run' c:/Ruby187/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mingw32/lib/mongrel.rb:268:ininiti
alize’
c:/Ruby187/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mingw32/lib/mongrel.rb:268:in
new' c:/Ruby187/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mingw32/lib/mongrel.rb:268:inrun’
c:/Ruby187/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/handler/mongrel.rb:34:in
run' c:/Ruby187/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/commands/server.rb:111 c:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:ingem_original_require

c:/Ruby187/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`require’
script/server:3

hmm… try to add in config/database.yml below password this line:
reconnect: true

On Tue, Jan 3, 2012 at 1:59 PM, Madhusudhan H R
[email protected]wrote:

I am running it on windows 2003 VM.
Rails versions in 2.3.5. Database is in another server not the same
server.

Thank you :slight_smile:

Sorry, I have little experience with this combination. I hope others
can help here.

Peter


Peter V.
http://twitter.com/peter_v
http://rails.vandenabeele.com