Reputation: 4248
So, I'm new in MacOs and in Ruby. I was playing a bit with Ruby on terminal, all went fine so far. Then I downloaded and installed the rails framework. All went fine! But when I start the server
rails server
and just after refreshing the "welcome aboard site" I get this error in terminal:
Mysql2::Error (Access denied for user 'root'@'localhost' (using password: NO)):
mysql2 (0.3.11) lib/mysql2/client.rb:44:in `connect'
mysql2 (0.3.11) lib/mysql2/client.rb:44:in `initialize'
There are more lines of errors, but I'm sure they are all related with couldn't find and/or couldn't connect to mySql. I have had installed the mySql server before installing rails to use it with Apache/PHP. So I think there must be somewhere a file to say rails where the server is or maybe tell rails user/password?
I was looking for a solution on Google but I just got results of people having troubles because of different things.
Upvotes: 0
Views: 89
Reputation: 6404
Please specify mysql username and password in config/database.yml file
for eg, for development environment:
development:
adapter: mysql2
encoding: utf8
database: < your database name>
username: <your usename>
password: <your password>
You can add more properties if you want, i've showed here only required fields.
Thanks
Upvotes: 1