Forum: Ruby on Rails connecting to mysql on OS X 10.4

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
866cdebb86508b024abfb733251d27dd?d=identicon&s=25 Chris Corwin (Guest)
on 2006-04-04 16:52
(Received via mailing list)
i have looked in the archives, i have the _agile_ book, and its links
right in front of me, and i have done pretty much everything i can
think to do except start from a fresh OS install, and yet i still can
not get Rails to talk to MySQL.



when i try to do this:

237:/Library/WebServer/Documents/Rails/depot chris$ ruby script/
generate scaffold Product Admin



i get this output:

       exists  app/controllers/
       exists  app/helpers/
       exists  app/views/admin
       exists  test/functional/
   dependency  model
       exists    app/models/
       exists    test/unit/
       exists    test/fixtures/
    identical    app/models/product.rb
    identical    test/unit/product_test.rb
    identical    test/fixtures/products.yml
Access denied for user: 'xxxxxxx@localhost' (Using password: YES)



the use in question exists, and Lasso (http://omnipilot.com) can get
to the databases just fine, as can i in cocoamysql -- so i *know* the
user/password combo works. it has for a long, long time.




so, i've tried the fixconfig and such...

here's an example output:

Attempting local installation of 'mysql'
Local gem file not found: mysql*.gem
Attempting remote installation of 'mysql'
Updating Gem source index for: http://gems.rubyforge.org
Building native extensions.  This could take a while...
ERROR:  While executing gem ... (RuntimeError)
     ERROR: Failed to build gem native extension.
Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/
mysql-2.7 for inspection.
   ruby extconf.rb install mysql\nchecking for mysql_query() in -
lmysqlclient... no
checking for main() in -lm... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lz... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lsocket... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lnsl... no
checking for mysql_query() in -lmysqlclient... no


Results logged to /usr/lib/ruby/gems/1.8/gems/mysql-2.7/gem_make.out



am i missing something?



     - chris corwin
       http://flickerbulb.com
Bd63aad8231c0ed5e15af54faaa09380?d=identicon&s=25 3quid (Guest)
on 2006-04-04 18:31
(Received via mailing list)
hi chris

I am stuck on the exact same line of code in the book.. i swear there
is a misprint or something! page 57 right?

anyway, i got past that error by including a specific username and
password (your login name and password) in my config/database.yml for
the development and test databases ... it says in the book that you
may have to do this with some combos of OSX/MySQL/Rails have you done
that?

anyhoo i now get an error upon reaching the same line in the output
( identical    test/fixtures/products.yml ) which reads ...

You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occured while evaluating nil.each

plus a whole load of other code if I add -t to the command (full
output in my thread "newbie generate scaffold")

let me know if the database.yml file solves your initial problem..
and if you get the same second error as me.

3Quid
email - threequid@gmail.com
-----------------------------------
msn - threequid@gmail.com
aim - threequid@mac.com
-----------------------------------
58d6cc890d970ab786d475ed62b460df?d=identicon&s=25 Jeff Everett (Guest)
on 2006-04-04 21:48
(Received via mailing list)
This will help with your mysql binding problem in OSX:

http://habtm.com/articles/2005/08/04/installing-ru...

You might also check to make sure you're using the new mysql password
hash that appeared in v4.1. If you're still using the old hash I don't
believe Rails 1.0 or newer will connect.

jeff
866cdebb86508b024abfb733251d27dd?d=identicon&s=25 Chris Corwin (Guest)
on 2006-04-05 02:42
(Received via mailing list)
On Apr 4, 2006, at 3:44 PM, Jeff Everett wrote:

> You might also check to make sure you're using the new mysql password
> hash that appeared in v4.1. If you're still using the old hash I don't
> believe Rails 1.0 or newer will connect.

awwwwww, that's so gotta be it  --- i am just stepping out, i'll lazy
web this:

how do i do that?


but i am using mysql 4, not 4.1..

?

     - chris corwin
       http://flickerbulb.com
866cdebb86508b024abfb733251d27dd?d=identicon&s=25 Chris Corwin (flickerbulbcom)
on 2006-04-05 07:18
(Received via mailing list)
On Apr 4, 2006, at 8:40 PM, Chris Corwin wrote:

> how do i do that?
>
>
> but i am using mysql 4, not 4.1..


a quick upgrade to MySQL 5.0 and i now get this:

b00ty:/Library/WebServer/Documents/Rails/depot chris$ ruby script/
generate scaffold Product Admin
       exists  app/controllers/
       exists  app/helpers/
       exists  app/views/admin
       exists  test/functional/
   dependency  model
       exists    app/models/
       exists    test/unit/
       exists    test/fixtures/
    identical    app/models/product.rb
    identical    test/unit/product_test.rb
    identical    test/fixtures/products.yml
You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occured while evaluating nil.each
b00ty:/Library/WebServer/Documents/Rails/depot chris$



*any* ideas would be soooo appreciated.




     - chris corwin
       317 418 1795
       http://flickerbulb.com
Ce01db9bec66e5796cad9fe202acf8e1?d=identicon&s=25 Chris Martin (Guest)
on 2006-04-08 00:30
(Received via mailing list)
On 4/4/06, Chris Corwin <chris@flickerbulb.com> wrote:
> > awwwwww, that's so gotta be it  --- i am just stepping out, i'll
> > lazy web this:
> >
> > how do i do that?
> >
> >
> > but i am using mysql 4, not 4.1..

I'll lazy answer ;)
Google for

rails mysqladmin password

--

Chris Martin
Web Developer
Open Source & Web Standards Advocate
http://www.chriscodes.com/
866cdebb86508b024abfb733251d27dd?d=identicon&s=25 Chris Corwin (flickerbulbcom)
on 2006-04-08 00:33
(Received via mailing list)
On Apr 7, 2006, at 6:27 PM, Chris Martin wrote:

>>>> believe Rails 1.0 or newer will connect.
> Google for
>
> rails mysqladmin password



heh -- yah, i got there, eventually.

that's not it though, sorta.

well, we'll see.

i ended up going to mysql 5, cause, why not?

now i get this:

b00ty:/Library/WebServer/Documents/Rails/depot chris$ ruby script/
generate scaffold Product Admin -t
       exists  app/controllers/
       exists  app/helpers/
       exists  app/views/admin
       exists  test/functional/
   dependency  model
       exists    app/models/
       exists    test/unit/
       exists    test/fixtures/
    identical    app/models/product.rb
    identical    test/unit/product_test.rb
    identical    test/fixtures/products.yml
You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occured while evaluating nil.each
   /usr/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/
connection_adapters/mysql_adapter.rb:293:in `columns'
   /usr/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/
base.rb:696:in `columns'
   /usr/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/
base.rb:1963:in `attributes_from_column_definition'
   /usr/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/
base.rb:1347:in `initialize_without_callbacks'
   /usr/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/
callbacks.rb:236:in `initialize'
   /usr/lib/ruby/gems/1.8/gems/rails-1.1.0/lib/rails_generator/
generators/components/scaffold/scaffold_generator.rb:182:in `new'
   /usr/lib/ruby/gems/1.8/gems/rails-1.1.0/lib/rails_generator/
generators/components/scaffold/scaffold_generator.rb:182:in
`model_instance'
   /usr/lib/ruby/gems/1.8/gems/rails-1.1.0/lib/rails_generator/
generators/components/scaffold/scaffold_generator.rb:164:in
`create_sandbox'
   /usr/lib/ruby/gems/1.8/gems/rails-1.1.0/lib/rails_generator/
generators/components/scaffold/scaffold_generator.rb:85:in `manifest'
   /usr/lib/ruby/gems/1.8/gems/rails-1.1.0/lib/rails_generator/
generators/components/scaffold/scaffold_generator.rb:85:in `call'
   /usr/lib/ruby/gems/1.8/gems/rails-1.1.0/lib/rails_generator/
commands.rb:106:in `render_template_part'
   /usr/lib/ruby/gems/1.8/gems/rails-1.1.0/lib/rails_generator/
commands.rb:284:in `complex_template'
   /usr/lib/ruby/gems/1.8/gems/rails-1.1.0/lib/rails_generator/
manifest.rb:47:in `send'
   /usr/lib/ruby/gems/1.8/gems/rails-1.1.0/lib/rails_generator/
manifest.rb:47:in `send_actions'
   /usr/lib/ruby/gems/1.8/gems/rails-1.1.0/lib/rails_generator/
manifest.rb:46:in `each'
   /usr/lib/ruby/gems/1.8/gems/rails-1.1.0/lib/rails_generator/
manifest.rb:46:in `send_actions'
   /usr/lib/ruby/gems/1.8/gems/rails-1.1.0/lib/rails_generator/
manifest.rb:31:in `replay'
   /usr/lib/ruby/gems/1.8/gems/rails-1.1.0/lib/rails_generator/
commands.rb:41:in `invoke!'
   /usr/lib/ruby/gems/1.8/gems/rails-1.1.0/lib/rails_generator/
scripts/../scripts.rb:31:in `run'
   /usr/lib/ruby/gems/1.8/gems/rails-1.1.0/lib/commands/generate.rb:6
   /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:in
`require__'
   /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:in
`require'
   /usr/lib/ruby/gems/1.8/gems/activesupport-1.3.0/lib/active_support/
dependencies.rb:136:in `require'
   script/generate:3
b00ty:/Library/WebServer/Documents/Rails/depot chris$



whiskey. tango. foxtrot.


     - chris corwin
       http://flickerbulb.com
This topic is locked and can not be replied to.