Riot wrote:
I'm on MAC OSX and I set up my environment as described here:
http://hivelogic.com/narrative/articles/ruby_rails_lighttpd_mysql_tiger?status=301
This may be too old and I just realized that, but before I attempt Building Ruby, Rails, Subversion, Mongrel, and MySQL on Mac OS X: Dan Benjamin
Okay, I purchased a book "Rails Solutions: Ruby on Rails Made Easy" and I'm following along w/ the tutorial.
I do not understand this thing at all... I'm 100% sure I'm doing everything right, except I still get this error. Perhaps I need to update my setup?
Here's what I do:
1. rails railslist
2. cd railslist
3. ruby script/server
4. Setup my Databases in Cocoa MySQL (localhost, root, password)
5. Update database.yml file w/ password (localhost and root are already set by default)
6. ruby script/generate model Classified
7. Update 001_create_classifieds.rb migration file w/
<code>class CreateClassifieds < ActiveRecord::Migration def self.up create_table :classifieds do |t| t.column :title, :string t.column :price, :float t.column :location, :string t.column :description, :text t.column :email, :string t.column :created_at, :timestamp t.column :updated_at, :timestamp end end
def self.down drop_table :classifieds end end</code>
8. rake migrate -- check to see tables have been made in Cocoa (success!)
9. ruby script/generate controller Classified
10. Update classified_controller.rb file w/
<code>class ClassifiedController < ApplicationController def list @classifieds = Classified.find(:all) end
def show @classified = Classified.find(params[:id]) end
def new end
def create end
def edit end
def update end
def delete end
end</code>
11. Point page to <a href="http://localhost:3000/classified/list">http://localhost:3000/classified/list</a>
12. ERROR #28000Access denied for user 'root'@'localhost' (using password: NO)
I don't get it, if rake can setup the tables then the rails must be communicating fine w/ MySQL ??
Shutdown the server. Check your database.yml file and make sure all the environments have a password set and try it again. The "(using password: NO)" implies it's using the default database.yml setup where root has no password rather than the one you configured. rake runs independent of the having a server running which is why it picked up the database.yml changes.