1

I have looked through a lot of similar solutions but have been unable to resolve my issue so hopefully someone can help.

I have joined a Rails project and need to pull data via a dump.sh file to enable me to work locally. Whenever I run the required command, I receive this error:

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

If I try mysql -u root I see the exact same error message.

Trying mysql -u root -p requires my password to be entered (it is the same password in the database.yml file) which is kind of weird - surely this step should not work based on my error message?

My database.yml file looks like this for development:

development: adapter: mysql2 database: database_development host: localhost port: 3306 username: root password: "password_is_here" pool: 5 timeout: 5000

I feel like I am missing something really basic here, but cannot for the life of me work out what it is :-/

EDIT: Forgot to mention, the database exists and has been migrated so rake db:create and rake db:migrate are not the issues.

EDIT2: My test database has the same information

6
  • Try this answer on stack overflow ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) to configure mysql correctly on linux Commented Aug 17, 2017 at 3:06
  • Unfortunately I don't see anything there that I haven't already tried (including setting new passwords, restarting the SQL server etc). I still continue to receive the "using password: NO" message. Commented Aug 17, 2017 at 3:11
  • How about your dump.sh script looks like ?. It will be helpful to answer the question if you posted the codes of dump.sh with your question.Have you added mysql privileges to it?. Commented Aug 17, 2017 at 3:17
  • It's something I cannot (contractually) post I am afraid - it definitely works though as others in my team have run it without issues. Commented Aug 17, 2017 at 3:18
  • Ok you have two solutions . You can change the permissions of dump.sh using chmod or chown commands to work locally on your computer. Or you can add the these changes to database.yml file as , add default: &default adapter: mysql2 encoding: utf8 pool: 5 username: root password: host: localhost development: <<: *default database: database_development Commented Aug 17, 2017 at 3:25

1 Answer 1

3

I have seen this error before, that was because the database.yml contain some special characters that can't see in normal mode of text editor. I suggest to try to create totally new database.yml file from scratch then input database info again manually, restart the server to check the result.

Sign up to request clarification or add additional context in comments.

1 Comment

Must have been something connected to that as you mentioned. Re-wrote it from scratch and it works perfectly now so thank you!

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.