The Afghan
The Afghan

Reputation: 99

"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. I used Mac 10.7 and I installed rubystack. I created the databases, add and checked the database.yml here is you can see it again.

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

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)

Upvotes: 0

Views: 900

Answers (3)

Alok Anand
Alok Anand

Reputation: 3356

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. I guess you might be having wrong username 'simplecms' written for test environment.... most probably.... do check...

Upvotes: 0

CDub
CDub

Reputation: 13354

You'll want to grant permissions on the simplecmsdevelopment database for simple_cms@localhost:

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.

Upvotes: 0

kddeisz
kddeisz

Reputation: 5182

Have you granted permissions for that user on that database? i.e., GRANT ALL PRIVILEGES ON simplecmsdevelopment.* TO simple_cms@localhost;

Upvotes: 1

Related Questions