Missing the mysql2 gem. Add it to your Gemfile: gem 'mysql2'

Hello I have this small script:

···

----------------------
require 'active_record'

ActiveRecord::Base.establish_connection(
  :adapter => 'mysql',
  :database => 'cards',
  :username => 'user',
  :password => 'myPassword',
  :host => 'localhost',
  :charset => 'utf8',
  :encoding => 'utf8',
  :port => '3306')

class Start < ActiveRecord::Base
  set_table_name "grb_tGStart"
  set_primary_key "start_id"
  has_many :posts
end

starts = Start.find(:all, :conditions => [ "agency_id = (?) AND
is_active = (?)", 17, 1 ])

----------------------

And I got this error:
----------------------
/activerecord-3.0.5/lib/active_record/connection_adapters/mysql_adapter.rb:22:in
`rescue in mysql_connection': !!!
Missing the mysql2 gem. Add it to your Gemfile: gem 'mysql2'
(RuntimeError)

----------------------
Every hint to this issue points on a file: database.yml and there to
change adapter: mysql, to adapter: mysql2.
But I don't know what's the file databases.yml :slight_smile: I don't have it in my
project. Can you please advice me, what's the file databases.yml?

--
Posted via http://www.ruby-forum.com/.