2012-01-29 49 views
1

我是新來的回報率從Django的到來,回報率是不容易的,我Django的,所以我想請你幫我回報率:無法連接到MySQL

當我嘗試做rake db:migraterake features或任何關於rake我看到this

有3件事我不明白:爲什麼不RoR連接到MySQL?爲什麼我看到這個耙錯誤?以及爲什麼我看到ansicoon錯誤...我已經安裝了它3次(但這不是一個重要的錯誤,所以如果你不知道如何修復它,那很好)我還安裝了最新版本或今天耙

我有導軌3,Windows XP的32位,SP3,我安裝使用railsinstaller

ROR的database.yml

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: &test 
    adapter: mysql 
    database: selvista_test 
    username: root 
    pool: 5 
    timeout: 5000 

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

cucumber: 
    <<: *test 

的Gemfile

source 'http://rubygems.org' 

gem 'rails', '3.0.6' 

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

gem 'mysql' 
gem 'rake', '0.9.2.2' 

#cucumber and some other gems 

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

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

# Deploy with Capistrano 
# gem 'capistrano' 

# To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+) 
# gem 'ruby-debug' 
# gem 'ruby-debug19', :require => 'ruby-debug' 

# Bundle the extra gems: 
# gem 'bj' 
# gem 'nokogiri' 
# gem 'sqlite3-ruby', :require => 'sqlite3' 
# gem 'aws-s3', :require => 'aws/s3' 

# Bundle gems for the local environment. Make sure to 
# put test-only gems in this group so their generators 
# and rake tasks are available in development mode: 
# group :development, :test do 
# gem 'webrat' 
# end 

如果你需要看到任何其他文件告訴我,我習慣於Django你有5個文件,你可以添加其他文件,如果你需要的話,這裏有軌道上的紅寶石我有很多文件夾和文件,我還不知道哪些文件很重要,哪些文件不重要

+2

你正在運行的Ruby 1.8.7。除非你有特殊原因,否則你應該運行最新版本。我看到你使用了[RailsInstaller](http://railsinstaller.org)。最新版本的RailsInstaller附帶Ruby 1.9.2。但我推薦[RubyInstaller](http://rubyinstaller.org),然後只需要'gem install rails'和其他寶石。 – danneu 2012-01-29 23:26:10

回答

2

這適用於XP和Windows 7,32或64位。在第2步中,您需要下載適當的版本(32位或64位)。我首先安裝了ruby gem pik和ruby 1.9.3(或者更新版本的最新版本),因爲ruby 1.8.7已經到了終點,但這取決於你。

  1. 創業板安裝mysql2
  2. Download MySQL 6 connector
  3. 提取MSI或zip文件。
  4. 將libmysql.dll移至路徑上的目錄。我的是C:\ ruby​​193 \ BIN

從無到有的完整說明是在rubyat.com/blog

1

另外我想你還需要MySQL2寶石。 https://github.com/brianmario/mysql2

+0

sir mysql2只適用於mysql 6.x客戶端,wamp和xampp沒有mysql 6.x,它們都使用5.5,所以如何使用mysql2?我使用xampp的方式 – Lynob 2012-01-30 19:12:37

+0

嗨,我正在運行Ruby 1.9.2,Rails 3.2.1和MySQL版本:5.5.13。和mysql2(0.3.11)。但是,我在OSX/Ubuntu 11上。也許你正在運行在不同的平臺上。 S – simonmorley 2012-01-30 19:40:44

+0

我在xp上,mysql2說它需要mysql 6客戶端,wamp和xampp不提供mysql 6,所以我不能使用mysql2,除非我可以以某種方式升級mysql ...我已經安裝了xampp – Lynob 2012-01-30 21:01:07