Problem with mysql: Access denied for user: '@localhost' (Us


#1

Hi,

I downloaded typo, toyed around with it on my mac, and now tried to
install it at my webhoster running SuSE Linux.

The databases are created, the schemas and records imported and I
changed
user/password/socket in database.yml.

When accessing http://localhost:3000/ I get this:

Mysql::Error in Articles#index

Access denied for user: ‘@localhost’ (Using password: NO)

RAILS_ROOT: .
Application Trace http://claudia-und-mariano.net:3000/# | Framework
Tracehttp://claudia-und-mariano.net:3000/#| Full
Trace http://claudia-und-mariano.net:3000/#

/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.13.1/lib/active_record/vendor/mysql.rb:510:in
read' /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.13.1/lib/active_record/vendor/mysql.rb:152:inreal_connect’
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.13.1/lib/active_record/connection_adapters/mysql_adapter.rb:45:in
mysql_connection' /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.13.1/lib/active_record/connection_adapters/abstract/connection_specification.rb:145:inconnection_without_query_cache=’
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.13.1/lib/active_record/query_cache.rb:54:in
connection=' /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.13.1/lib/active_record/connection_adapters/abstract/connection_specification.rb:106:inretrieve_connection’
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.13.1/lib/active_record/connection_adapters/abstract/connection_specification.rb:20:in
connection' /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.13.1/lib/active_record/base.rb:931:inadd_limit!’
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.13.1/lib/active_record/base.rb:924:in
construct_finder_sql' /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.13.1/lib/active_record/base.rb:395:infind’
#{RAILS_ROOT}/app/models/config_manager.rb:13:in reload' #{RAILS_ROOT}/app/models/config_manager.rb:4:ininitialize’
#{RAILS_ROOT}/app/models/configuration.rb:33:in config' #{RAILS_ROOT}/app/helpers/application_helper.rb:13:inrender_file’

/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.13.1/lib/active_record/vendor/mysql.rb:510:in
read' /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.13.1/lib/active_record/vendor/mysql.rb:152:inreal_connect’
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.13.1/lib/active_record/connection_adapters/mysql_adapter.rb:45:in
mysql_connection' /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.13.1/lib/active_record/connection_adapters/abstract/connection_specification.rb:145:inconnection_without_query_cache=’
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.13.1/lib/active_record/query_cache.rb:54:in
connection=' /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.13.1/lib/active_record/connection_adapters/abstract/connection_specification.rb:106:inretrieve_connection’
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.13.1/lib/active_record/connection_adapters/abstract/connection_specification.rb:20:in
connection' /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.13.1/lib/active_record/base.rb:931:inadd_limit!’
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.13.1/lib/active_record/base.rb:924:in
construct_finder_sql' /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.13.1/lib/active_record/base.rb:395:infind’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.11.1/lib/action_controller/rescue.rb:73:in
rescue_action_locally' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.11.1/lib/action_controller/rescue.rb:31:inrescue_action’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.11.1/lib/action_controller/rescue.rb:108:in
perform_action' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.11.1/lib/action_controller/base.rb:369:inprocess_without_session_management_support’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.11.1/lib/action_controller/session_management.rb:116:in
process' /usr/local/lib/ruby/gems/1.8/gems/rails-0.14.4/lib/dispatcher.rb:38:indispatch’
/usr/local/lib/ruby/gems/1.8/gems/rails-0.14.4/lib/webrick_server.rb:117:in
handle_dispatch' /usr/local/lib/ruby/gems/1.8/gems/rails-0.14.4/lib/webrick_server.rb:83:inservice’
/usr/local/lib/ruby/1.8/webrick/httpserver.rb:104:in service' /usr/local/lib/ruby/1.8/webrick/httpserver.rb:65:inrun’
/usr/local/lib/ruby/1.8/webrick/server.rb:173:in start_thread' /usr/local/lib/ruby/1.8/webrick/server.rb:162:instart_thread’
/usr/local/lib/ruby/1.8/webrick/server.rb:95:in start' /usr/local/lib/ruby/1.8/webrick/server.rb:92:instart’
/usr/local/lib/ruby/1.8/webrick/server.rb:23:in start' /usr/local/lib/ruby/1.8/webrick/server.rb:82:instart’
/usr/local/lib/ruby/gems/1.8/gems/rails-0.14.4/lib/webrick_server.rb:69:in
dispatch' /usr/local/lib/ruby/gems/1.8/gems/rails-0.14.4/lib/commands/servers/webrick.rb:59 /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:inrequire’
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.2.4/lib/active_support/dependencies.rb:214:in
require' /usr/local/lib/ruby/gems/1.8/gems/rails-0.14.4/lib/commands/server.rb:28 /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:inrequire’
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.2.4/lib/active_support/dependencies.rb:214:in
`require’
script/server:3

/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.13.1/lib/active_record/vendor/mysql.rb:510:in
read' /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.13.1/lib/active_record/vendor/mysql.rb:152:inreal_connect’
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.13.1/lib/active_record/connection_adapters/mysql_adapter.rb:45:in
mysql_connection' /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.13.1/lib/active_record/connection_adapters/abstract/connection_specification.rb:145:inconnection_without_query_cache=’
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.13.1/lib/active_record/query_cache.rb:54:in
connection=' /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.13.1/lib/active_record/connection_adapters/abstract/connection_specification.rb:106:inretrieve_connection’
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.13.1/lib/active_record/connection_adapters/abstract/connection_specification.rb:20:in
connection' /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.13.1/lib/active_record/base.rb:931:inadd_limit!’
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.13.1/lib/active_record/base.rb:924:in
construct_finder_sql' /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.13.1/lib/active_record/base.rb:395:infind’
#{RAILS_ROOT}/app/models/config_manager.rb:13:in reload' #{RAILS_ROOT}/app/models/config_manager.rb:4:ininitialize’
#{RAILS_ROOT}/app/models/configuration.rb:33:in config' #{RAILS_ROOT}/app/helpers/application_helper.rb:13:inrender_file’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.11.1/lib/action_controller/rescue.rb:73:in
rescue_action_locally' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.11.1/lib/action_controller/rescue.rb:31:inrescue_action’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.11.1/lib/action_controller/rescue.rb:108:in
perform_action' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.11.1/lib/action_controller/base.rb:369:inprocess_without_session_management_support’
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.11.1/lib/action_controller/session_management.rb:116:in
process' /usr/local/lib/ruby/gems/1.8/gems/rails-0.14.4/lib/dispatcher.rb:38:indispatch’
/usr/local/lib/ruby/gems/1.8/gems/rails-0.14.4/lib/webrick_server.rb:117:in
handle_dispatch' /usr/local/lib/ruby/gems/1.8/gems/rails-0.14.4/lib/webrick_server.rb:83:inservice’
/usr/local/lib/ruby/1.8/webrick/httpserver.rb:104:in service' /usr/local/lib/ruby/1.8/webrick/httpserver.rb:65:inrun’
/usr/local/lib/ruby/1.8/webrick/server.rb:173:in start_thread' /usr/local/lib/ruby/1.8/webrick/server.rb:162:instart_thread’
/usr/local/lib/ruby/1.8/webrick/server.rb:95:in start' /usr/local/lib/ruby/1.8/webrick/server.rb:92:instart’
/usr/local/lib/ruby/1.8/webrick/server.rb:23:in start' /usr/local/lib/ruby/1.8/webrick/server.rb:82:instart’
/usr/local/lib/ruby/gems/1.8/gems/rails-0.14.4/lib/webrick_server.rb:69:in
dispatch' /usr/local/lib/ruby/gems/1.8/gems/rails-0.14.4/lib/commands/servers/webrick.rb:59 /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:inrequire’
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.2.4/lib/active_support/dependencies.rb:214:in
require' /usr/local/lib/ruby/gems/1.8/gems/rails-0.14.4/lib/commands/server.rb:28 /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:inrequire’
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.2.4/lib/active_support/dependencies.rb:214:in
`require’
script/server:3

Request

Parameters: None

Show session dump http://claudia-und-mariano.net:3000/#
Response Headers: {“cookie”=>[], “Cache-Control”=>“no-cache”}

I am really wondering why it reads “Using password: NO”, because I
defined
user and password in database.yml.

I did some digging with google, but haven’t found a solution yet. On my
way
I tried to install the native libraries with no too much luck either:

gem install mysql – --with-mysql-dir=/usr/lib/mysql/

Attempting local installation of ‘mysql’
Local gem file not found: mysql*.gem
Attempting remote installation of ‘mysql’
Building native extensions. This could take a while…
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.

Provided configuration options:
–with-opt-dir
–with-opt-include=${opt-dir}/include
–with-opt-lib=${opt-dir}/lib
–with-make-prog=make
–srcdir=.
–curdir
–ruby=/usr/local/bin/ruby
–with-mysql-config
–with-mysql-dir=/usr/local
–with-mysql-include=${mysql-dir}/include
–with-mysql-lib=${mysql-dir}/lib
–with-mysqlclientlib=mysqlclient
–with-mlib=m
–with-mysqlclientlib=mysqlclient
–with-zlib=z
–with-mysqlclientlib=mysqlclient
–with-socketlib=socket
–with-mysqlclientlib=mysqlclient
–with-nsllib=nsl
–with-mysqlclientlib=mysqlclient
ERROR: While executing gem … (RuntimeError)
ERROR: Failed to build gem native extension.
Gem files will remain installed in
/usr/local/lib/ruby/gems/1.8/gems/mysql-
2.7 for inspection.
ruby extconf.rb install mysql –
–with-mysql-dir=/usr/lib/mysql/\nchecking for mysql_query() in
-lmysqlclient… no
checking for main() in -lm… yes
checking for mysql_query() in -lmysqlclient… no
checking for main() in -lz… yes
checking for mysql_query() in -lmysqlclient… no
checking for main() in -lsocket… no
checking for mysql_query() in -lmysqlclient… no
checking for main() in -lnsl… yes
checking for mysql_query() in -lmysqlclient… no

Results logged to
/usr/local/lib/ruby/gems/1.8/gems/mysql-2.7/gem_make.out

Not sure what to do.

FWIW this is the output of uname -a:
Linux lvps87-230-0-229.dedicated.hosteurope.de
2.4.20-021stab028.17.777-enterprise #1 SMP Tue Jul 19 19:31:27 MSD 2005
i686
i686 i386 GNU/Linux

I would be really happy if I don’t have to use YaST, because this is
seriously broken on this machine … Any help is appreciated though.

Cheers,
Mariano


#2

Hi,

what version of mysql and Rails (RC??) do you use?
There is a bug concerning RC5 and Mysql 4.0.

Beate


#3

not sure what version of mysql you are using, but these may help,
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/169979
http://comments.gmane.org/gmane.comp.lang.ruby.rails/33919
some people are claiming that you need native C mysql-ruby bindings
but I don’t think it’s necessary.


#4

Lou,

the second link you posted seems somewhat inconclusive to me, but from
that message I gather that I have three options

a) go back to an older version of rails,
b) upgrade mysql (can't do that due to the broken linux installation 

I
am using) or
c) to give postgresql a shot?!

Is that it?

Cheers,
Mariano


#5

yeah, you are using old passwords and that version of rails has a bug
that is trying to log you in with new passwords.
Either upgrade the database to 4.1+ or 5.0+ or try
another gem version (version 0.14.3 is almost sure to work).
reviewing the referenced threads, too, may help.


#6

Hello Beate,

“gem list rails” produces:

*** LOCAL GEMS ***

rails (0.14.4)
Web-application framework with template engine, control-flow layer,
and ORM.

And logging into mysql it greets me with version “4.0.18”…

Does this help?

Cheers,
Mariano


#7

On 12/13/05, Mariano K. removed_email_address@domain.invalid wrote:

And logging into mysql it greets me with version “4.0.18”…

Does this help?

I had the same problem. It’s fixed in the new version of ActiveRecord.

AJS


#8

AJS,

that sounds to good to be true.

How do I get the new version of active record?

I did an “gem install activerecord” that said it installed 1.13.2, but
that didn’t help …

Cheers,
Mariano

Many thanks to you and everybody helping me out here!


#9

Mariano, you should do a

gem update rails --include-dependencies

otherwise you might have unmet dependencies.

HTH,
Beate


#10

yes, or try a bleeding edge version of ActiveRecord/Rails. If the report
is
true, a new version of Rails was just released that may fix this.
There are directions on the download page of the main Rails web site
that
explain how to get a bleeding edge version if that is your inclination.

another solution would be to hack on the ‘real_connect’ method in
mysql.rb,
if you are an accomplished rubyist.


#11

Beate,

thank you very much.

HTH
It sure did :wink:

Cheers,
Mariano