Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/293.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mysql ruby on rails第一个应用程序访问被拒绝_Mysql_Ruby On Rails - Fatal编程技术网

Mysql ruby on rails第一个应用程序访问被拒绝

Mysql ruby on rails第一个应用程序访问被拒绝,mysql,ruby-on-rails,Mysql,Ruby On Rails,我正在尝试Ruby,我以前用Java开发过。经过一些努力,我使用MySql2创建了一个使用bitnami rubystack的应用程序。我遇到了一些关于连接器的错误,但我解除了它的stackoverflow。当然,现在我遇到了一个错误,并尝试了stackoverflow解决方案,但它不起作用,所以我在这里问,我尝试了从主机切换到插座,然后再切换回来。每次更改database.yml后,我都会重新启动rails服务器。我需要这样做吗 我正在获取MYSQL2::Error 用户“rubystack”

我正在尝试Ruby,我以前用Java开发过。经过一些努力,我使用MySql2创建了一个使用bitnami rubystack的应用程序。我遇到了一些关于连接器的错误,但我解除了它的stackoverflow。当然,现在我遇到了一个错误,并尝试了stackoverflow解决方案,但它不起作用,所以我在这里问,我尝试了从主机切换到插座,然后再切换回来。每次更改database.yml后,我都会重新启动rails服务器。我需要这样做吗

我正在获取MYSQL2::Error 用户“rubystack”@“localhost”使用密码的访问被拒绝:是

=> Booting WEBrick
=> Rails 4.1.7 application starting in development on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Notice: server is listening on all interfaces (0.0.0.0). Consider using 127.0.0.1 (--binding opt
on)
=> Ctrl-C to shutdown server
[2014-11-26 18:38:31] INFO  WEBrick 1.3.1
[2014-11-26 18:38:31] INFO  ruby 2.0.0 (2014-10-27) [i386-mingw32]
[2014-11-26 18:38:31] INFO  WEBrick::HTTPServer#start: pid=4984 port=3000


Started GET "/" for 127.0.0.1 at 2014-11-26 18:40:54 +1100

Mysql2::Error (Access denied for user 'rubystack'@'localhost' (using password: YES)):
  mysql2 (0.3.17) lib/mysql2/client.rb:70:in `connect'
  mysql2 (0.3.17) lib/mysql2/client.rb:70:in `initialize'
  activerecord (4.1.7) lib/active_record/connection_adapters/mysql2_adapter.rb:18:in `new'
  activerecord (4.1.7) lib/active_record/connection_adapters/mysql2_adapter.rb:18:in `mysql2_connec
ion'
  activerecord (4.1.7) lib/active_record/connection_adapters/abstract/connection_pool.rb:435:in `ne
_connection'
  activerecord (4.1.7) lib/active_record/connection_adapters/abstract/connection_pool.rb:445:in `ch
ckout_new_connection'
  activerecord (4.1.7) lib/active_record/connection_adapters/abstract/connection_pool.rb:416:in `ac
uire_connection'
  activerecord (4.1.7) lib/active_record/connection_adapters/abstract/connection_pool.rb:351:in `bl
ck in checkout'
  C:/Bitnami/rubystack-2.0.0-23/ruby/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
  activerecord (4.1.7) lib/active_record/connection_adapters/abstract/connection_pool.rb:350:in `ch
ckout'
  activerecord (4.1.7) lib/active_record/connection_adapters/abstract/connection_pool.rb:265:in `bl
ck in connection'
  C:/Bitnami/rubystack-2.0.0-23/ruby/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
  activerecord (4.1.7) lib/active_record/connection_adapters/abstract/connection_pool.rb:264:in `co
nection'
  activerecord (4.1.7) lib/active_record/connection_adapters/abstract/connection_pool.rb:541:in `re
rieve_connection'
  activerecord (4.1.7) lib/active_record/connection_handling.rb:113:in `retrieve_connection'
  activerecord (4.1.7) lib/active_record/connection_handling.rb:87:in `connection'
  activerecord (4.1.7) lib/active_record/query_cache.rb:51:in `restore_query_cache_settings'
  activerecord (4.1.7) lib/active_record/query_cache.rb:43:in `rescue in call'
  activerecord (4.1.7) lib/active_record/query_cache.rb:32:in `call'
  activerecord (4.1.7) lib/active_record/connection_adapters/abstract/connection_pool.rb:621:in `ca
l'
  activerecord (4.1.7) lib/active_record/migration.rb:380:in `call'
  actionpack (4.1.7) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
  activesupport (4.1.7) lib/active_support/callbacks.rb:82:in `run_callbacks'
  actionpack (4.1.7) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
  actionpack (4.1.7) lib/action_dispatch/middleware/reloader.rb:73:in `call'
  actionpack (4.1.7) lib/action_dispatch/middleware/remote_ip.rb:76:in `call'
  actionpack (4.1.7) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
  actionpack (4.1.7) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
  railties (4.1.7) lib/rails/rack/logger.rb:38:in `call_app'
  railties (4.1.7) lib/rails/rack/logger.rb:20:in `block in call'
  activesupport (4.1.7) lib/active_support/tagged_logging.rb:68:in `block in tagged'
  activesupport (4.1.7) lib/active_support/tagged_logging.rb:26:in `tagged'
  activesupport (4.1.7) lib/active_support/tagged_logging.rb:68:in `tagged'
  railties (4.1.7) lib/rails/rack/logger.rb:20:in `call'
  actionpack (4.1.7) lib/action_dispatch/middleware/request_id.rb:21:in `call'
  rack (1.5.2) lib/rack/methodoverride.rb:21:in `call'
  rack (1.5.2) lib/rack/runtime.rb:17:in `call'
  activesupport (4.1.7) lib/active_support/cache/strategy/local_cache_middleware.rb:26:in `call'
  rack (1.5.2) lib/rack/lock.rb:17:in `call'
  actionpack (4.1.7) lib/action_dispatch/middleware/static.rb:84:in `call'
  rack (1.5.2) lib/rack/sendfile.rb:112:in `call'
  railties (4.1.7) lib/rails/engine.rb:514:in `call'
  railties (4.1.7) lib/rails/application.rb:144:in `call'
  rack (1.5.2) lib/rack/lock.rb:17:in `call'
  rack (1.5.2) lib/rack/content_length.rb:14:in `call'
  rack (1.5.2) lib/rack/handler/webrick.rb:60:in `service'
  C:/Bitnami/rubystack-2.0.0-23/ruby/lib/ruby/2.0.0/webrick/httpserver.rb:138:in `service'
  C:/Bitnami/rubystack-2.0.0-23/ruby/lib/ruby/2.0.0/webrick/httpserver.rb:94:in `run'
  C:/Bitnami/rubystack-2.0.0-23/ruby/lib/ruby/2.0.0/webrick/server.rb:295:in `block in start_thread



  Rendered C:/Bitnami/rubystack-2.0.0-23/ruby/lib/ruby/gems/2.0.0/gems/actionpack-4.1.7/lib/action_
ispatch/middleware/templates/rescues/_source.erb (1.0ms)
  Rendered C:/Bitnami/rubystack-2.0.0-23/ruby/lib/ruby/gems/2.0.0/gems/actionpack-4.1.7/lib/action_
ispatch/middleware/templates/rescues/_trace.html.erb (4.0ms)
  Rendered C:/Bitnami/rubystack-2.0.0-23/ruby/lib/ruby/gems/2.0.0/gems/actionpack-4.1.7/lib/action_
ispatch/middleware/templates/rescues/_request_and_response.html.erb (3.0ms)
  Rendered C:/Bitnami/rubystack-2.0.0-23/ruby/lib/ruby/gems/2.0.0/gems/actionpack-4.1.7/lib/action_
ispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (180.1ms)
my database.yml如下所示:

# MySQL.  Versions 5.0+ are recommended.
#
# Install the MYSQL driver
#   gem install mysql2
#
# Ensure the MySQL gem is defined in your Gemfile
#   gem 'mysql2'
#
# And be sure to use new-style password hashing:
#   http://dev.mysql.com/doc/refman/5.0/en/old-client.html
#
default: &default
  adapter: mysql2
  encoding: utf8
  pool: 5
  username: root
  password: bitnami123
  host: localhost

development:
  <<: *default
  database: myapp2_dev
  username: rubystack
  password: bitnami1
  #password: <%= ENV['MYAPP2_DATABASE_PASSWORD'] %>
  host: localhost
  #socket: C:\Bitnami\rubystack-2.0.0-23\mysql\tmp\mysql.sock

# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
  <<: *default
  database: myapp2_test
  username: rubystack
  password: bitnami1
  host: localhost
  #socket: C:\Bitnami\rubystack-2.0.0-23\mysql\tmp\mysql.sock

# As with config/secrets.yml, you never want to store sensitive information,
# like your database password, in your source code. If your source code is
# ever seen by anyone, they now have access to your database.
#
# Instead, provide the password as a unix environment variable when you boot
# the app. Read http://guides.rubyonrails.org/configuring.html#configuring-a-database
# for a full rundown on how to provide these environment variables in a
# production deployment.
#
# On Heroku and other platform providers, you may have a full connection URL
# available as an environment variable. For example:
#
#   DATABASE_URL="mysql2://myuser:mypass@localhost/somedatabase"
#
# You can use this database configuration with:
#
#   production:
#     url: <%= ENV['DATABASE_URL'] %>
#
production:
  <<: *default
  database: myapp2_production
  username: rubystack
  password: bitnami1
  host: localhost
  #socket: C:\Bitnami\rubystack-2.0.0-23\mysql\tmp\mysql.sock
  #password: <%= ENV['MYAPP2_DATABASE_PASSWORD'] %>
有没有人遇到它并解决了它??在哪里可以找到Ruby/Bitnami中的日志文件。日志文件夹为空。顺便说一句:我可以使用$Mysql-u rubystack-p myapp2_dev访问Mysql并输入密码。数据库存在,用户存在,用户rubystack有Previlliges

编辑:我从database.yml中删除了rubystack user的所有痕迹,而是将root作为用户,并将password字段更改为root的password,现在它仍然显示: 拒绝使用密码访问用户“root”@“localhost”:是 先谢谢你