2

I get the following error, when trying to generate an app.

I have a database.yml with my db login info, but not sure what this error is exactly. Does anyone know what it is?

I assume it is verify login to the test db.

3
  • 8
    you don't have the correct user/pw set up to connect to your mysql db Commented Feb 6, 2013 at 21:19
  • Thats what I thought. hmmm... ok. Commented Feb 6, 2013 at 21:42
  • Can you connect using: mysql -u root or do you need a password as in mysql -u root -p? If you need a password, then check your database.yml and make sure you actually have the username and password specified. In fact, how bout pasting your development settings from you database.yml here if you're still having trouble. Commented Feb 6, 2013 at 22:02

3 Answers 3

5

Make sure that your db username and password are configured for the development environment, not just the test environment. Initial rails application setup is there.

The test database is used by tests, such as rake spec or rake test and the development database is used when you are working with rails such as rails generate or rails console.

A typical setup is below:

development:
  adapter: mysql2
  encoding: utf8
  reconnect: false
  database: foo_development
  pool: 5
  username: db_username
  password: db_password
  socket: /tmp/mysql.sock

test:
  adapter: mysql2
  encoding: utf8
  reconnect: false
  database: foo_test
  pool: 5
  username: db_username
  password: db_password
  socket: /tmp/mysql.sock
Sign up to request clarification or add additional context in comments.

4 Comments

I have set for development, I think the issue that it needs a root user with no password.
It doesn't need that, it is just the default. Changing config/database.yml is how you override the default.
You are right, but for this specific app you can not change then database.yml, it requires root user/no PW. Thanks
Then the problem is that your mysql instance has a password set for root. see if mysql -u root works.
1

Why do you want to have root user access your application?

It's recommended you create a different user and grant all privileges to this user and then configure your database.yml with those credentials.

Comments

1

I wanted to contribute my answer to this. It sounds kind of amateur but it may help some poor chap that had the same issue as me.

I had my password in database.yml configured like this:

development:
  <<: *default
  database: my_db_name
  username: my_username
  password: !?my_password913

It's a rookie mistake but it screwed me up for a few minutes. Ensure you wrap your password with quotes if you use special characters because ! for instance would evaluate as a boolean expression of false which would make mysql2 ignore the password field and send password=no

Thanks!

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.