[英]“Access Denied” when rails connects to Mysql
I have did all the procedures as mentioned in several places and I also learned from lynda.com video tutorial. 我已经在几个地方完成了提到的所有步骤,并且我还从lynda.com视频教程中学到了东西。 I used Mac 10.7 and I installed rubystack.
我使用Mac 10.7,并安装了rubystack。 I created the databases, add and checked the database.yml here is you can see it again.
我创建了数据库,添加并检查了database.yml,在这里您可以再次看到它。
development:
adapter: mysql2
encoding: utf8
reconnect: false
host: localhost
database: simplecmsdevelopment
pool: 5
username: simple_cms
password: maiwandj
socket: /tmp/mysql.sock
Therefore, when I run rake db:schema:dump it print the following errors 因此,当我运行rake db:schema:dump时,它会显示以下错误
bash-3.2$ rake db:schema:dump
/Applications/rubystack-1.9.3-18/ruby/lib/ruby/gems/1.9.1/gems/bundler-1.5.2/lib/bundler/runtime.rb:220: warning: Insecure world writable dir /usr/local/bin in PATH, mode 040777
rake aborted!
Access denied for user 'simplecms'@'localhost' (using password: YES)
/Applications/rubystack-1.9.3-18/simplecms/config/environment.rb:5:in `' Tasks: TOP => db:schema:dump => environment (See full trace by running task with --trace)
Have you granted permissions for that user on that database? 您是否已授予该用户对该数据库的权限? ie,
GRANT ALL PRIVILEGES ON simplecmsdevelopment.* TO simple_cms@localhost;
即,将
GRANT ALL PRIVILEGES ON simplecmsdevelopment.* TO simple_cms@localhost;
You'll want to grant permissions on the simplecmsdevelopment
database for simple_cms@localhost
: 您将要授予对
simple_cms@localhost
的simplecmsdevelopment
数据库的权限:
GRANT ALL PRIVILEGES ON 'simplecmsdevelopment'.* TO 'simple_cms'@'localhost';
You might want to change the directory permissions to something like 755 for /usr/local/bin
as well... That should fix the warning. 您可能还希望将
/usr/local/bin
的目录权限更改为755,这样可以解决警告。
DB yml Config file mentions username: simple_cms, but error message in console mentions user 'simplecms'@'localhost'.... I would suggest you should rewrite db yml configurations. DB yml Config文件提到用户名:simple_cms,但是控制台中的错误消息提到了用户'simplecms'@'localhost'....我建议您应该重写db yml配置。 I guess you might be having wrong username 'simplecms' written for test environment .... most probably.... do check...
我想您可能在为测试环境编写的用户名'simplecms'错误....最有可能....进行检查...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.