2012-02-05 148 views
0

我使用的是windows xp 32 pro,bit,sp3。 railsinstallermysql2 gem的最新版本Ruby on rails:mysql錯誤

我一直在試圖解決這個錯誤所有這一週。當我運行rake db:create我看到這個錯誤

enter image description here

this is what i see when i trace the error

我已經從mysql-connector-c-noinstall-6.0.2-win32-vs2005\lib

下載the zipped version of mysql Connector/C 6.0.2 for 32 bit和複製libmysql.dllC:\RailsInstaller\Ruby1.9.2\bin

現在當我運行rake db:create解決了這個錯誤我看到

enter image description here

and this is what i see when i trace the error

我希望這些信息將幫助你,幫我解決了問題:)

@phoet

我的Gemfile

source 'http://rubygems.org' 

gem 'rails', '3.1.1' 

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

gem 'mysql2' 
gem 'cucumber' 
gem 'database_cleaner' 
gem 'cucumber-rails' 
gem 'capybara' 
gem 'rspec', '2.8' 
gem 'rspec-rails', '2.8' 
gem 'launchy' 
gem 'spork' 


# Gems used only for assets and not required 
# in production environments by default. 
group :assets do 
    gem 'sass-rails', '~> 3.1.4' 
    gem 'coffee-rails', '~> 3.1.1' 
    gem 'uglifier', '>= 1.0.3' 
end 

gem 'jquery-rails' 

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

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

# Deploy with Capistrano 
# gem 'capistrano' 

# To use debugger 
# gem 'ruby-debug19', :require => 'ruby-debug' 

group :test do 
    # Pretty printed test output 
    gem 'turn', :require => false 
end 

我的數據庫配置

development: 
    adapter: mysql 
    database: selvista 
    username: root 
    pool: 5 
    timeout: 5000 

# Warning: The database defined as "test" will be erased and 
# re-generated from your development database when you run "rake". 
# Do not set this db to the same as development or production. 
test: 
    adapter: mysql 
    database: selvista_test 
    username: root 
    pool: 5 
    timeout: 5000 

production: 
    adapter: mysql 
    database: selvista_prod 
    username: root 
    pool: 5 
    timeout: 5000 

應我的適配器是mysql2

+0

給你認爲會工作,我從來沒有否決的答案,因爲誰回答我的問題,正在努力幫助 – Lynob 2012-02-05 14:38:53

+1

請張貼分貝配置和正在使用的Gemfile中的任何解決方案。我假設你沒有正確定義mysql依賴。 – phoet 2012-02-05 14:41:56

+0

@phoet請閱讀我的編輯 – Lynob 2012-02-05 14:50:53

回答

2

你可以嘗試將mysql2放在你的適配器行中database.yml中。

development: 
    adapter: mysql2 
    database: selvista 
    username: root 
    pool: 5 
    timeout: 5000 

# Warning: The database defined as "test" will be erased and 
# re-generated from your development database when you run "rake". 
# Do not set this db to the same as development or production. 
test: 
    adapter: mysql2 
    database: selvista_test 
    username: root 
    pool: 5 
    timeout: 5000 

production: 
    adapter: mysql2 
    database: selvista_prod 
    username: root 
    pool: 5 
    timeout: 5000