我使用的是 windows xp 32 pro, bit, sp3。最新版本railsinstaller和 mysql2 gem
这周我一直在努力解决这个错误。当我运行 rake db:create
时,我看到此错误
this is what i see when i trace the error
我已经通过下载 the zipped version of mysql Connector/C 6.0.2 for 32 bit 解决了这个错误并从 mysql-connector-c-noinstall-6.0.2-win32-vs2005\lib
复制 libmysql.dll
到C:\RailsInstaller\Ruby1.9.2\bin
现在当我运行rake db:create
时我明白了
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
吗?
最佳答案
您可以尝试将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
关于mysql - Ruby on Rails : mysql error,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9149827/