我试图将Ruby应用程序与MySQL数据库相结合。每次我收到以下错误:
/home/swapnasa/.rvm/gems/ruby-1.9.3-p448/gems/mysql2-0.3.11/lib/mysql2/client.rb:44:in `connect': Mysql2::Error: Access denied for user 'swapnasa'@'localhost' (using password: NO) (Sequel::DatabaseConnectionError)
from /home/swapnasa/.rvm/gems/ruby-1.9.3-p448/gems/mysql2-0.3.11/lib/mysql2/client.rb:44:in `initialize'
from /home/swapnasa/.rvm/gems/ruby-1.9.3-p448/gems/sequel-3.48.0/lib/sequel/adapters/mysql2.rb:34:in `new'
from /home/swapnasa/.rvm/gems/ruby-1.9.3-p448/gems/sequel-3.48.0/lib/sequel/adapters/mysql2.rb:34:in `connect'
from /home/swapnasa/.rvm/gems/ruby-1.9.3-p448/gems/sequel-3.48.0/lib/sequel/connection_pool.rb:94:in `make_new'
from /home/swapnasa/.rvm/gems/ruby-1.9.3-p448/gems/sequel-3.48.0/lib/sequel/connection_pool/threaded.rb:158:in `make_new'
from /home/swapnasa/.rvm/gems/ruby-1.9.3-p448/gems/sequel-3.48.0/lib/sequel/connection_pool/threaded.rb:137:in `available'
from /home/swapnasa/.rvm/gems/ruby-1.9.3-p448/gems/sequel-3.48.0/lib/sequel/connection_pool/threaded.rb:127:in `block in acquire'
from /home/swapnasa/.rvm/gems/ruby-1.9.3-p448/gems/sequel-3.48.0/lib/sequel/connection_pool/threaded.rb:194:in `block in sync'
from <internal:prelude>:10:in `synchronize'
from /home/swapnasa/.rvm/gems/ruby-1.9.3-p448/gems/sequel-3.48.0/lib/sequel/connection_pool/threaded.rb:194:in `sync'
from /home/swapnasa/.rvm/gems/ruby-1.9.3-p448/gems/sequel-3.48.0/lib/sequel/connection_pool/threaded.rb:126:in `acquire'
from /home/swapnasa/.rvm/gems/ruby-1.9.3-p448/gems/sequel-3.48.0/lib/sequel/connection_pool/threaded.rb:94:in `hold'
from /home/swapnasa/.rvm/gems/ruby-1.9.3-p448/gems/sequel-3.48.0/lib/sequel/database/connecting.rb:235:in `synchronize'
from /home/swapnasa/.rvm/gems/ruby-1.9.3-p448/gems/sequel-3.48.0/lib/sequel/adapters/shared/mysql_prepared_statements.rb:34:in `execute'
from /home/swapnasa/.rvm/gems/ruby-1.9.3-p448/gems/sequel-3.48.0/lib/sequel/dataset/actions.rb:860:in `execute'
from /home/swapnasa/.rvm/gems/ruby-1.9.3-p448/gems/sequel-3.48.0/lib/sequel/adapters/mysql2.rb:159:in `execute'
from /home/swapnasa/.rvm/gems/ruby-1.9.3-p448/gems/sequel-3.48.0/lib/sequel/adapters/mysql2.rb:137:in `fetch_rows'
from /home/swapnasa/.rvm/gems/ruby-1.9.3-p448/gems/sequel-3.48.0/lib/sequel/dataset/actions.rb:156:in `each'
from /home/swapnasa/.rvm/gems/ruby-1.9.3-p448/gems/sequel-3.48.0/lib/sequel/dataset/actions.rb:437:in `map'
from /home/swapnasa/.rvm/gems/ruby-1.9.3-p448/gems/sequel-3.48.0/lib/sequel/dataset/actions.rb:437:in `map'
from /home/swapnasa/.rvm/gems/ruby-1.9.3-p448/gems/sequel-3.48.0/lib/sequel/adapters/shared/mysql.rb:451:in `schema_parse_table'
from /home/swapnasa/.rvm/gems/ruby-1.9.3-p448/gems/sequel-3.48.0/lib/sequel/database/query.rb:197:in `schema'
from /home/swapnasa/.rvm/gems/ruby-1.9.3-p448/gems/sequel-3.48.0/lib/sequel/model/base.rb:795:in `block in get_db_schema'
from /home/swapnasa/.rvm/gems/ruby-1.9.3-p448/gems/sequel-3.48.0/lib/sequel/model/base.rb:719:in `check_non_connection_error'
from /home/swapnasa/.rvm/gems/ruby-1.9.3-p448/gems/sequel-3.48.0/lib/sequel/model/base.rb:795:in `get_db_schema'
from /home/swapnasa/.rvm/gems/ruby-1.9.3-p448/gems/sequel-3.48.0/lib/sequel/model/base.rb:572:in `block in set_dataset'
from /home/swapnasa/.rvm/gems/ruby-1.9.3-p448/gems/sequel-3.48.0/lib/sequel/model/base.rb:719:in `check_non_connection_error'
from /home/swapnasa/.rvm/gems/ruby-1.9.3-p448/gems/sequel-3.48.0/lib/sequel/model/base.rb:572:in `set_dataset'
from /home/swapnasa/.rvm/gems/ruby-1.9.3-p448/gems/sequel-3.48.0/lib/sequel/model.rb:46:in `Model'
from /home/swapnasa/Downloads/irclogger-master/lib/irclogger/message.rb:3:in `<top (required)>'
from /home/swapnasa/Downloads/irclogger-master/lib/irclogger.rb:8:in `require'
from /home/swapnasa/Downloads/irclogger-master/lib/irclogger.rb:8:in `<top (required)>'
from viewer.ru:3:in `require'
from viewer.ru:3:in `block in <main>'
from /home/swapnasa/.rvm/gems/ruby-1.9.3-p448/gems/rack-1.5.2/lib/rack/builder.rb:55:in `instance_eval'
from /home/swapnasa/.rvm/gems/ruby-1.9.3-p448/gems/rack-1.5.2/lib/rack/builder.rb:55:in `initialize'
from viewer.ru:1:in `new'
from viewer.ru:1:in `<main>'
from /home/swapnasa/.rvm/gems/ruby-1.9.3-p448/gems/thin-1.5.1/lib/rack/adapter/loader.rb:33:in `eval'
from /home/swapnasa/.rvm/gems/ruby-1.9.3-p448/gems/thin-1.5.1/lib/rack/adapter/loader.rb:33:in `load'
from /home/swapnasa/.rvm/gems/ruby-1.9.3-p448/gems/thin-1.5.1/lib/thin/controllers/controller.rb:181:in `load_rackup_config'
from /home/swapnasa/.rvm/gems/ruby-1.9.3-p448/gems/thin-1.5.1/lib/thin/controllers/controller.rb:71:in `start'
from /home/swapnasa/.rvm/gems/ruby-1.9.3-p448/gems/thin-1.5.1/lib/thin/runner.rb:187:in `run_command'
from /home/swapnasa/.rvm/gems/ruby-1.9.3-p448/gems/thin-1.5.1/lib/thin/runner.rb:152:in `run!'
from /home/swapnasa/.rvm/gems/ruby-1.9.3-p448/gems/thin-1.5.1/bin/thin:6:in `<top (required)>'
from /home/swapnasa/.rvm/gems/ruby-1.9.3-p448/bin/thin:19:in `load'
from /home/swapnasa/.rvm/gems/ruby-1.9.3-p448/bin/thin:19:in `<main>'
请注意,我已授予对数据库的swapnasa @ localhost访问权限。我仍然得到这个错误。我做错了什么?