Topic: "rails new test_app -d mysql" with "rails s" doesn't load WEBrick

Running: Windows 7 x64bit

Enviornment Information:
C:\Users\R>ruby -v
ruby 1.9.3p327 (2012-11-10) [i386-mingw32]

C:\Users\R>rails -v
Rails 3.2.9

C:\Users\R>gem -v

C:\Users\R>gem env
RubyGems Environment:
  - RUBY VERSION: 1.9.3 (2012-11-10 patchlevel 327) [i386-mingw32]
  - INSTALLATION DIRECTORY: C:/Ruby193/lib/ruby/gems/1.9.1
  - RUBY EXECUTABLE: C:/Ruby193/bin/ruby.exe
    - ruby
    - x86-mingw32
     - C:/Ruby193/lib/ruby/gems/1.9.1
     - C:\Users\R/.gem/ruby/1.9.1
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000


When I try to create a project with mysql I can't load WEBrick even with the bundle install


Error Steps:
C:\Users\R>cd documents

C:\Users\R\Documents>rails new test_project -d mysql
      create  README.rdoc
      create  Rakefile
      create  .gitignore
      create  Gemfile
      create  app
      create  app/assets/images/rails.png
      create  app/assets/javascripts/application.js
      create  app/assets/stylesheets/application.css
      create  app/controllers/application_controller.rb
      create  app/helpers/application_helper.rb
      create  app/mailers
      create  app/models
      create  app/views/layouts/application.html.erb
      create  app/mailers/.gitkeep
      create  app/models/.gitkeep
      create  config
      create  config/routes.rb
      create  config/application.rb
      create  config/environment.rb
      create  config/environments
      create  config/environments/development.rb
      create  config/environments/production.rb
      create  config/environments/test.rb
      create  config/initializers
      create  config/initializers/backtrace_silencers.rb
      create  config/initializers/inflections.rb
      create  config/initializers/mime_types.rb
      create  config/initializers/secret_token.rb
      create  config/initializers/session_store.rb
      create  config/initializers/wrap_parameters.rb
      create  config/locales
      create  config/locales/en.yml
      create  config/boot.rb
      create  config/database.yml
      create  db
      create  db/seeds.rb
      create  doc
      create  doc/README_FOR_APP
      create  lib
      create  lib/tasks
      create  lib/tasks/.gitkeep
      create  lib/assets
      create  lib/assets/.gitkeep
      create  log
      create  log/.gitkeep
      create  public
      create  public/404.html
      create  public/422.html
      create  public/500.html
      create  public/favicon.ico
      create  public/index.html
      create  public/robots.txt
      create  script
      create  script/rails
      create  test/fixtures
      create  test/fixtures/.gitkeep
      create  test/functional
      create  test/functional/.gitkeep
      create  test/integration
      create  test/integration/.gitkeep
      create  test/unit
      create  test/unit/.gitkeep
      create  test/performance/browsing_test.rb
      create  test/test_helper.rb
      create  tmp/cache
      create  tmp/cache/assets
      create  vendor/assets/javascripts
      create  vendor/assets/javascripts/.gitkeep
      create  vendor/assets/stylesheets
      create  vendor/assets/stylesheets/.gitkeep
      create  vendor/plugins
      create  vendor/plugins/.gitkeep
         run  bundle install
Fetching gem metadata from
Fetching gem metadata from
Using rake (10.0.1)
Using i18n (0.6.1)
Using multi_json (1.3.7)
Using activesupport (3.2.9)
Using builder (3.0.4)
Using activemodel (3.2.9)
Using erubis (2.7.0)
Using journey (1.0.4)
Using rack (1.4.1)
Using rack-cache (1.2)
Using rack-test (0.6.2)
Using hike (1.2.1)
Using tilt (1.3.3)
Using sprockets (2.2.1)
Using actionpack (3.2.9)
Using mime-types (1.19)
Using polyglot (0.3.3)
Using treetop (1.4.12)
Using mail (2.4.4)
Using actionmailer (3.2.9)
Using arel (3.0.2)
Using tzinfo (0.3.35)
Using activerecord (3.2.9)
Using activeresource (3.2.9)
Using bundler (1.2.2)
Using coffee-script-source (1.4.0)
Using execjs (1.4.0)
Using coffee-script (2.2.0)
Using rack-ssl (1.3.2)
Using json (1.7.5)
Using rdoc (3.12)
Using thor (0.16.0)
Using railties (3.2.9)
Using coffee-rails (3.2.2)
Using jquery-rails (2.1.3)
Using mysql2 (0.3.11)
Using rails (3.2.9)
Using sass (3.2.3)
Using sass-rails (3.2.5)
Using uglifier (1.3.0)
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem
is installed.

C:\Users\R\Documents>cd test_project

C:\Users\R\Documents\test_project>rails server
rb:2:in `require': 126: Impossível localizar o módulo especificado.   - C:/Ruby1
93/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11-x86-mingw32/lib/mysql2/1.9/ (
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11-x86-mingw32/lib/m
ysql2/mysql2.rb:2:in `<top (required)>'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11-x86-mingw32/lib/m
ysql2.rb:9:in `require'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11-x86-mingw32/lib/m
ysql2.rb:9:in `<top (required)>'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.2.2/lib/bundler/runti
me.rb:68:in `require'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.2.2/lib/bundler/runti
me.rb:68:in `block (2 levels) in require'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.2.2/lib/bundler/runti
me.rb:66:in `each'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.2.2/lib/bundler/runti
me.rb:66:in `block in require'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.2.2/lib/bundler/runti
me.rb:55:in `each'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.2.2/lib/bundler/runti
me.rb:55:in `require'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/bundler-1.2.2/lib/bundler.rb:12
8:in `require'
        from C:/Users/RUI/Documents/test_project/config/application.rb:7:in `<to
p (required)>'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.9/lib/rails/comman
ds.rb:53:in `require'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.9/lib/rails/comman
ds.rb:53:in `block in <top (required)>'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.9/lib/rails/comman
ds.rb:50:in `tap'
        from C:/Ruby193/lib/ruby/gems/1.9.1/gems/railties-3.2.9/lib/rails/comman
ds.rb:50:in `<top (required)>'
        from script/rails:6:in `require'
        from script/rails:6:in `<main>'

Project Gemfile:

source ''

gem 'rails', '3.2.9'

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://'

gem 'mysql2'

# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'

  # See for more supported runtimes
  # gem 'therubyracer', :platforms => :ruby

  gem 'uglifier', '>= 1.0.3'

gem 'jquery-rails'

# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'

# To use Jbuilder templates for JSON
# gem 'jbuilder'

# Use unicorn as the app server
# gem 'unicorn'

# Deploy with Capistrano
# gem 'capistrano'

# To use debugger
# gem 'debugger'


But if I create a project without '-d mysql', WEBrick loads fine with the standart 'sqlite3' and I can enter http://localhost:3000/.
The main question I have about this is how can I create a project with mysql instead of sqlite3 as a server.

Thank you


Re: "rails new test_app -d mysql" with "rails s" doesn't load WEBrick

I think the problem is in the right version of mysql2 gem to use, - in your case it should be the one for 64 bits. It seems that you use the one for 32 bits. Try to uninstall it and use this one: … mswin32-60

If it still fails, post the issue at mysql2 github: