1

I can't seem to get mysql to work with my new rails app at all... terminal copy below:

Janes-MacBook-Pro:development janelee$ cd hellomysql
Janes-MacBook-Pro:hellomysql janelee$ rails server
/Users/janelee/.rvm/gems/ruby-1.8.7-p174/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle: dlopen(/Users/janelee/.rvm/gems/ruby-1.8.7-p174/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle, 9): no suitable image found.  Did find: (LoadError)
    /Users/janelee/.rvm/gems/ruby-1.8.7-p174/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle: mach-o, but wrong architecture - /Users/janelee/.rvm/gems/ruby-1.8.7-p174/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle
    from /Users/janelee/.rvm/gems/ruby-1.8.7-p174/gems/mysql2-0.3.11/lib/mysql2.rb:9
    from /Users/janelee/.rvm/gems/ruby-1.8.7-p174/gems/bundler-1.0.22/lib/bundler/runtime.rb:68:in `require'
    from /Users/janelee/.rvm/gems/ruby-1.8.7-p174/gems/bundler-1.0.22/lib/bundler/runtime.rb:68:in `require'
    from /Users/janelee/.rvm/gems/ruby-1.8.7-p174/gems/bundler-1.0.22/lib/bundler/runtime.rb:66:in `each'
    from /Users/janelee/.rvm/gems/ruby-1.8.7-p174/gems/bundler-1.0.22/lib/bundler/runtime.rb:66:in `require'
    from /Users/janelee/.rvm/gems/ruby-1.8.7-p174/gems/bundler-1.0.22/lib/bundler/runtime.rb:55:in `each'
    from /Users/janelee/.rvm/gems/ruby-1.8.7-p174/gems/bundler-1.0.22/lib/bundler/runtime.rb:55:in `require'
    from /Users/janelee/.rvm/gems/ruby-1.8.7-p174/gems/bundler-1.0.22/lib/bundler.rb:122:in `require'
    from /Users/janelee/Development/hellomysql/config/application.rb:7
    from /Users/janelee/.rvm/gems/ruby-1.8.7-p174/gems/railties-3.2.1/lib/rails/commands.rb:53:in `require'
    from /Users/janelee/.rvm/gems/ruby-1.8.7-p174/gems/railties-3.2.1/lib/rails/commands.rb:53
    from /Users/janelee/.rvm/gems/ruby-1.8.7-p174/gems/railties-3.2.1/lib/rails/commands.rb:50:in `tap'
    from /Users/janelee/.rvm/gems/ruby-1.8.7-p174/gems/railties-3.2.1/lib/rails/commands.rb:50
    from script/rails:6:in `require'
    from script/rails:6
Janes-MacBook-Pro:hellomysql janelee$ rake db:migrate
rake aborted!
dlopen(/Users/janelee/.rvm/gems/ruby-1.8.7-p174/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle, 9): no suitable image found.  Did find:
    /Users/janelee/.rvm/gems/ruby-1.8.7-p174/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle: mach-o, but wrong architecture - /Users/janelee/.rvm/gems/ruby-1.8.7-p174/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle

(See full trace by running task with --trace)

and I tried this too:

Janes-MacBook-Pro:hello janelee$ gem uninstall sqlite3

You have requested to uninstall the gem:
    sqlite3-1.3.5
i18n-0.6.0 depends on [sqlite3 (>= 0)]
If you remove this gems, one or more dependencies will not be met.
Continue with Uninstall? [Yn]  y
Successfully uninstalled sqlite3-1.3.5
Janes-MacBook-Pro:hello janelee$ ARCHFLAGS="-arch x86_32" sudo gem install sqlite3
Password:
Building native extensions.  This could take a while...
Successfully installed sqlite3-1.3.5
1 gem installed
Janes-MacBook-Pro:hello janelee$ rake db:migrate
rake aborted!
dlopen(/Users/janelee/.rvm/gems/ruby-1.8.7-p174/gems/sqlite3-1.3.5/lib/sqlite3/sqlite3_native.bundle, 9): no suitable image found.  Did find:
    /Users/janelee/.rvm/gems/ruby-1.8.7-p174/gems/sqlite3-1.3.5/lib/sqlite3/sqlite3_native.bundle: mach-o, but wrong architecture - /Users/janelee/.rvm/gems/ruby-1.8.7-p174/gems/sqlite3-1.3.5/lib/sqlite3/sqlite3_native.bundle

(See full trace by running task with --trace)

and this:

Janes-MacBook-Pro:hello janelee$ gem uninstall sqlite3

You have requested to uninstall the gem:
    sqlite3-1.3.5
i18n-0.6.0 depends on [sqlite3 (>= 0)]
If you remove this gems, one or more dependencies will not be met.
Continue with Uninstall? [Yn]  y
Successfully uninstalled sqlite3-1.3.5
Janes-MacBook-Pro:hello janelee$ ARCHFLAGS="-arch x86_64" sudo gem install sqlite3
Building native extensions.  This could take a while...
Successfully installed sqlite3-1.3.5
1 gem installed
Janes-MacBook-Pro:hello janelee$ rake db:migrate
rake aborted!
dlopen(/Users/janelee/.rvm/gems/ruby-1.8.7-p174/gems/sqlite3-1.3.5/lib/sqlite3/sqlite3_native.bundle, 9): no suitable image found.  Did find:
    /Users/janelee/.rvm/gems/ruby-1.8.7-p174/gems/sqlite3-1.3.5/lib/sqlite3/sqlite3_native.bundle: mach-o, but wrong architecture - /Users/janelee/.rvm/gems/ruby-1.8.7-p174/gems/sqlite3-1.3.5/lib/sqlite3/sqlite3_native.bundle

(See full trace by running task with --trace)

What else should I try before reinstall Lion?

Tad Donaghe
  • 6,625
  • 1
  • 29
  • 64
  • Are you able to update ruby to 1.9.something and then run 'bundle install' ?? – Perry Horwich Feb 23 '12 at 05:45
  • Janes-MacBook-Pro:hello janelee$ rvm use 1.9.3 info: Using ruby 1.9.3 p125 Janes-MacBook-Pro:hello janelee$ ruby -v ruby 1.9.3p125 (2012-02-16 revision 34643) [x86_64-darwin11.3.0] Janes-MacBook-Pro:hello janelee$ bundle install ERROR: Gem bundler is not installed, run `gem install bundler` first. Janes-MacBook-Pro:hello janelee$ gem install bundler Fetching: bundler-1.0.22.gem (100%) Successfully installed bundler-1.0.22 1 gem installed Janes-MacBook-Pro:hello janelee$ bundle install ERROR: Gem bundler is not installed, run `gem install bundler` first. – user1227196 Feb 23 '12 at 16:31
  • Look into using Ruby Version Manager (called rvm) and then update Ruby. Try using ver 1.9 of ruby or higher. Don't reinstall your OS. If anything, remove rails, remove ruby. Install rvm, install ruby 1.9, install rails. If you follow that recipe, all should be well. – Perry Horwich Feb 23 '12 at 16:36
  • Thanks you, I think I got sqlite3 working, still working on mysql connection now... – user1227196 Feb 23 '12 at 17:12
  • Thanks again Perry, I think I got a way around it for now for mysql with info searched here, thanks for helping me figured out the first error, literally thought I'd have to reinstall Lion... – user1227196 Feb 23 '12 at 18:20

1 Answers1

1

Look into using Ruby Version Manager (called rvm) and then update Ruby. Try using ver 1.9 of ruby or higher. Don't reinstall your OS. If anything, remove rails, remove ruby. Install rvm, install ruby 1.9, install rails. If you follow that recipe, all should be well.

Configuring Rails to work with MySQL will happen through changing the file:

myappname/config/database.yml  

Good information is here: How do I set MySQL as the default database in Rails 3?

... and here: Create a new Ruby on Rails application using MySQL instead of SQLite

Get used to looking at the Rails guides. Examples like this: http://guides.rubyonrails.org/getting_started.html#configuring-a-database are all you need to get going.

Community
  • 1
  • 1
Perry Horwich
  • 2,798
  • 3
  • 23
  • 51