简体   繁体   中英

Connecting Ruby rails to MySQL database

I hope this question is not redundant. I saw a question almost like it but as the problem was a bit different it was no help.

I'm trying to connect my ruby rails Application to my MySQL database when using sudo rake db:migrate however (and some other commands) I get the following output

The error says I have a password set but so far as I can tell I do not. I have taken every measure I can think of to ensure that there is none set.

rake aborted!
Mysql::Error: Access denied for user 'root'@'localhost' (using password: YES)
/var/lib/gems/1.9.1/gems/activerecord-4.2.2/lib/active_record/connection_adapters/mysql_adapter.rb:456:in `real_connect'
/var/lib/gems/1.9.1/gems/activerecord-4.2.2/lib/active_record/connection_adapters/mysql_adapter.rb:456:in `connect'
/var/lib/gems/1.9.1/gems/activerecord-4.2.2/lib/active_record/connection_adapters/mysql_adapter.rb:108:in `initialize'
/var/lib/gems/1.9.1/gems/activerecord-4.2.2/lib/active_record/connection_adapters/mysql_adapter.rb:36:in `new'
/var/lib/gems/1.9.1/gems/activerecord-4.2.2/lib/active_record/connection_adapters/mysql_adapter.rb:36:in `mysql_connection'
/var/lib/gems/1.9.1/gems/activerecord-4.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:438:in `new_connection'
/var/lib/gems/1.9.1/gems/activerecord-4.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:448:in `checkout_new_connection'
/var/lib/gems/1.9.1/gems/activerecord-4.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:422:in `acquire_connection'
/var/lib/gems/1.9.1/gems/activerecord-4.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:349:in `block in checkout'
/var/lib/gems/1.9.1/gems/activerecord-4.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:348:in `checkout'
/var/lib/gems/1.9.1/gems/activerecord-4.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:263:in `block in connection'
/var/lib/gems/1.9.1/gems/activerecord-4.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:262:in `connection'
/var/lib/gems/1.9.1/gems/activerecord-4.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:567:in `retrieve_connection'
/var/lib/gems/1.9.1/gems/activerecord-4.2.2/lib/active_record/connection_handling.rb:113:in `retrieve_connection'
/var/lib/gems/1.9.1/gems/activerecord-4.2.2/lib/active_record/connection_handling.rb:87:in `connection'
/var/lib/gems/1.9.1/gems/activerecord-4.2.2/lib/active_record/migration.rb:913:in `initialize'
/var/lib/gems/1.9.1/gems/activerecord-4.2.2/lib/active_record/migration.rb:820:in `new'
/var/lib/gems/1.9.1/gems/activerecord-4.2.2/lib/active_record/migration.rb:820:in `up'
/var/lib/gems/1.9.1/gems/activerecord-4.2.2/lib/active_record/migration.rb:798:in `migrate'
/var/lib/gems/1.9.1/gems/activerecord-4.2.2/lib/active_record/tasks/database_tasks.rb:137:in `migrate'
/var/lib/gems/1.9.1/gems/activerecord-4.2.2/lib/active_record/railties/databases.rake:44:in `block (2 levels) in <top (required)>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)

I'm still fairly new to this so if there is any pertinent information I have not provided please let me know.

Any help would be vary much appreciated.

The (using password: YES) portion of the error error indicates that you sent a password to authenticate, not that one is set. Remove the password: whatever line from your database.yml, if you do not have one set on the database.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM