[英]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.