1
votes

I'm brand new to developing and ruby on rails. I'm on Windows 7, have ruby 2.1.6, rails 4.2.3, MySQL 5.6.26, and Sublime Text 2 (2.0.2) installed. I'm following an online tutorial on lynda.com about ruby on rails 4 essentials and ran into a problem trying to connect with my localhost:3000 rails server. I'm getting this error every time.

Mysql2::Error (Access denied for user 'root'@'localhost' (using password: NO))

and then a whole bunch of lines of code in the command prompt I don't understand. I need some help sorting this out please!

2
You don't have a MySQL user named "root" with no password. This seems to be a MySQL administration issue. - Dave Newton
In the video tutorial the instructor had us go into our app, simple_cms/confiig/database.yml and insert our password, (which I did), but our usernames were already set as root. He didn't make any changes to his username so I didn't either. As for the database field ours was set to simple_cms_development. He said we could either leave it or use a # symbol to cancel it out because it "technically didn't exist yet". I tried both to no avail. - Michael Lachine
I'm saying it's a MySQL issue, not Rails-the user you're trying to use doesn't exist as you're trying to use it, e.g., root has a password. - Dave Newton

2 Answers

1
votes

Go to your_app/ config/database.yml and in username insert your MySQL username (ex. Root) and in password your MySQL password. Don't forget to fill also the field "database".

1
votes

The error is caused by wrong credentials. You must set database_name, user_name and password.