2012-01-29 51 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