Lynob
Lynob

Reputation: 5327

RoR: cannot connect to mysql

I'm new to RoR coming from django, RoR is not as easy as django for me so i would like you to help me

when i try to do rake db:migrate or rake features or anything concerning rake i see this

there are 3 things i don't understand: why doesn't RoR connect to mysql? why am i seeing this rake error? and why am i seeing ansicoon error... i have installed it 3 times ( but that's not an important error so if you don't know how to fix it that's fine) i have also installed the latest version or rake today

I have rails 3, windows xp 32 bit, sp3, i installed ror using railsinstaller

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

if you need to see any other file tell me, i'm used to django where you have 5 files and you can add other files if you need to, here's with ruby on rails i have many folders and file, i don't know yet which files are important and which files are not

Upvotes: 1

Views: 1093

Answers (2)

Thomas L. Lucero
Thomas L. Lucero

Reputation: 46

This works on XP and Windows 7, 32 or 64 bit. In step 2, you need to download the appropriate version (32 or 64 bit). I'd first install the ruby gem pik and ruby 1.9.3 (or the latest version if greater) as ruby 1.8.7 is reaching end of life, but that's up to you.

  1. gem install mysql2
  2. Download MySQL 6 connector
  3. Extract the msi or zip file.
  4. Move libmysql.dll to a directory on your path. Mine is C:\ruby193\bin

Full instructions from scratch are at rubyat.com/blog

Upvotes: 2

simonmorley
simonmorley

Reputation: 2804

Plus I think you also need the MySQL2 gem. https://github.com/brianmario/mysql2

Upvotes: 1

Related Questions