简体   繁体   English

MySQL DB的Rails项目连接错误-拒绝root用户访问

[英]Rails Project Connection error with MySQL DB - Access Denied for root user

I get this error when running rails with mysql db. 使用mysql db运行rails时出现此错误。 Basically it is not giving the root user access. 基本上,它不授予root用户访问权限。 I have no idea why this is and have been stuck with this for a while now. 我不知道为什么会这样,现在已经坚持了一段时间。

Mysql2::Error (Access denied for user 'root'@'localhost' (using password: YES)):
Rendered /Users/USER/.rvm/gems/ruby-1.9.2-p290/gems/actionpack- 3.1.0/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.3ms)
Rendered /Users/USER/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.1.0/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (5.7ms)
Rendered /Users/USER/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.1.0/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (17.7ms)

My Database.yml file is posted below for your reference. 我的Database.yml文件发布在下面,以供您参考。 Im not sure how i check the password that MYSQL is automatically assigned to? 我不确定如何检查MYSQL自动分配给的密码? Would it be my computer login password? 是我的计算机登录密码吗? Anyhow how do i check it. 无论如何我要检查它。 Also i cant simply type mysql on my command line i have to enter the entire path to access it. 我也不能在命令行上简单地输入mysql,我必须输入整个路径才能访问它。 How do i change it. 我该如何更改。 Most importantly i want to know how this access denied issue can be resolved. 最重要的是,我想知道如何解决此拒绝访问问题。 Thank you. 谢谢。 Using mysql 5.5 on mac. 在Mac上使用mysql 5.5 x86_64 build. x86_64构建。

# And be sure to use new-style password hashing:
# http://dev.mysql.com/doc/refman/5.0/en/old-client.html
development:
  adapter: mysql2
  encoding: utf8
  reconnect: false
  database: project1_db
  pool: 5
  user : root
  username: root
  password: password
  host: localhost

# 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:
  adapter: mysql2
  encoding: utf8
  reconnect: false
  database: project1_db
  pool: 5
  user : root
  username: root
  password: password
  host: localhost

production:
  adapter: mysql2
  encoding: utf8
  reconnect: false
  database: project1_db
  pool: 5
  user : root
  username: root
  password: password
  host: localhost

Mysql uses the one that you've set on install. Mysql使用您在安装时设置的版本。 Sometimes it's empty. 有时是空的。 Try mysql -u root. 尝试mysql -u root。 If it works - remove pass string form database yaml. 如果有效,请从数据库yaml中删除传递字符串。 If it's not empty - https://stackoverflow.com/search?q=mysql+reset+password 如果不为空-https: //stackoverflow.com/search?q=mysql+reset+password

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 rails db:migrate rails已中止! Mysql2 :: Error:用户'root'@'localhost'的访问被拒绝(使用密码:是) - rails db:migrate rails aborted! Mysql2::Error: Access denied for user 'root'@'localhost' (using password: YES) Ruby on Rails MYSQL 错误用户“root@localhost”拒绝访问 - Ruby on Rails MYSQL error Access denied for user 'root@localhost' Rails mysql 用户'root'@'localhost'的访问被拒绝(使用密码:否)错误 - Rails mysql Access denied for user 'root'@'localhost' (using password: NO) error root MySQL用户无法访问数据库 - Access denied for root MySQL user to DB MySQL 错误::“用户'root'@'localhost'的访问被拒绝” - MySQL Error: : 'Access denied for user 'root'@'localhost' mysql 错误用户'root'@'localhost'的访问被拒绝 - mysql error Access denied for user 'root'@'localhost' Locall MySQL数据库登录错误:用户'root'@'localhost'的访问被拒绝(使用密码:是) - Locall MySQL DB login Error : Access denied for user 'root'@'localhost' (using password: YES) 用户 'root'@'localhost' 的访问被拒绝 - Spring 引导和 MySQL 连接 - Access Denied for user 'root'@'localhost' - Spring Boot & MySQL connection JDBC 连接到 MySql 错误 - 用户 'root'@'localhost' 的访问被拒绝(使用密码:否) - JDBC Connection to MySql error - Access denied for user 'root'@'localhost' (using password: NO) 用户 'user'@'localhost' 的访问被拒绝(来自 Intellij 的 MySQL 数据库连接错误) - Access denied for user 'user'@'localhost' (MySQL DB connection error from Intellij)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM