Access denied for user 'dashboard'@'localhost' to database 'dashboard_production'

1,549 views
Skip to first unread message

Hai

unread,
Jul 6, 2012, 5:08:53 PM7/6/12
to puppet...@googlegroups.com
followed the instruction for installing dashboard, and created user

mysql -pmy_password -e "CREATE DATABASE dashboard CHARACTER SET utf8;CREATE USER 'dashboard'@'localhost' IDENTIFIED BY 'my_password'; GRANT ALL PRIVILEGES ON dashboard.* TO 'dashboard'@'localhost';"

however, I keep getting access denied error:

# rake RAILS_ENV=production db:migrate
(in /usr/share/puppet-dashboard)
rake aborted!
Access denied for user 'dashboard'@'localhost' to database 'dashboard_production'

(See full trace by running task with --trace)


please help!

Peter Bukowinski

unread,
Jul 6, 2012, 5:15:46 PM7/6/12
to puppet...@googlegroups.com
Your created a database 'dashboard'. Make sure to put that name into the 'production:' section of your [dashboad_root]/config/database.yml file.

--
Peter Bukowinski

DJames

unread,
Jun 26, 2013, 8:58:55 AM6/26/13
to puppet...@googlegroups.com
Make sure you are able to see the schema.

Do a

mysql> show tables;


if you dont see the DB, then you need to make the DB. 

Stefan Lasiewski

unread,
Aug 9, 2013, 7:43:25 PM8/9/13
to puppet...@googlegroups.com
This is an old post, but I'll respond anyways for posterity. My summer intern just ran into this problem.

@pmbuko has the correct solution-- create a database named 'dashboard' and make sure that database.yml says 'dashboard' and not something else like 'dashboard_production'.

 I'll explain why this error happened. This is a common mistake with Ruby-based software. If you follow the instructions http://docs.puppetlabs.com/dashboard/manual/1.2/bootstrapping.html , it's easy to see why.

The instructions at  say to create a database named 'dashboard':


   
CREATE DATABASE dashboard CHARACTER SET utf8;
CREATE USER 'dashboard'@'localhost' IDENTIFIED BY 'my_password';
GRANT ALL PRIVILEGES ON dashboard.* TO 'dashboard'@'localhost';

However, the file `config/database.yml.example` says the database is named 'dashboard_production':

production:
  database: dashboard_production
  username: dashboard
  password:
  encoding: utf8
  adapter: mysql

If you copy config/database.yml.example to config/database.yml verbatim, then the command `rake RAILS_ENV=production db:migrate` will fail because it's expecting to find a database named 'dashboard_production'.

The simplest fix is to create a database named 'dashboard' and update database.yml to use that name. A longer, but possibly more correct, solution would be to create three databases following the Ruby naming convention (dashboard_production , dashboard_development & dashboard_test) and grant privileges on all three databases. But that is probably more work then necessary for most people, and I suspect that most folks just use a single database named 'dashboard'.

-= Stefan

Stuart Cracraft

unread,
Dec 24, 2013, 1:57:48 PM12/24/13
to puppet...@googlegroups.com
This is helpful.

On Friday, July 6, 2012 2:08:53 PM UTC-7, Hai wrote:
Reply all
Reply to author
Forward
0 new messages