I have following configuration:
Ruby version 1.9.2 (i386-mingw32)
RubyGems version 1.7.2
Rack version 1.2
Rails version 3.0.3
Active Record version 3.0.1
Action Pack version 3.0.3
Active Resource version 3.0.3
Action Mailer version 3.0.3
Active Support version 3.0.3
I am running rake db:create
command but it returns nothing and using trace, I find following output on the screen
E:\Crawler\server>rake db:create --trace
** Invoke db:create (first_time)
** Invoke db:load_config (first_time)
** Invoke rails_env (first_time)
** Execute rails_env
** Execute db:load_config
** Execute db:create
rake aborted!
C:/Ruby192/lib/ruby/gems/1.9.1/gems/mysql2-0.2.7/lib/active_record/connection_adapters/mysql2_adapter.rb:312:in `query'
C:/Ruby192/lib/ruby/gems/1.9.1/gems/mysql2-0.2.7/lib/active_record/connection_adapters/mysql2_adapter.rb:312:in `execute
When I run rake db:migrate command, it returns following:
E:\Crawler\server> rake db:migrate
rake aborted!
Unknown database 'marketplace_development'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
My rake file is:
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require File.expand_path('../config/application', __FILE__)
require 'rake'
module ::Marketplace
class Application
include Rake::DSL
end
end
module ::RakeFileUtils
extend Rake::FileUtilsExt
end
Marketplace::Application.load_tasks
database.yml file:
# MySQL. Versions 4.1 and 5.0 are recommended.
#
# Install the MySQL driver:
# gem install mysql2
#
# And be sure to use new-style password hashing:
# http://dev.mysql.com/doc/refman/5.0/en/old-client.html
development:
adapter: mysql2
encoding: utf8
reconnect: false
database: Marketplace_development
pool: 5
username: root
password:
socket: /tmp/mysql.sock
Can anybody tell me what's happening here? I have not created any database explicitly on my own. Do I need to create a database with some tool? I have seen other SO threads but no avail.
Edit1::
As suggested by Rogier, I opened up MySQL command line client
and ran following command
create schema marketplace_development;
Now both commands db:create
and db:migrate
hang up upon execution.
Edit2::
Every time I restart my command window and start a server with rails server
, it asks me to install now ActiveRecord mysql2. I install with gem install activerecord-msql2-adpater
, uninstall mysql2 (0.3.11-x86-ming32)
, update my Gemfile.lock
file to just have mysql2 (0.2.7)
.
I run bundle install
and start my rails server which is started successfully. But I am not able to view the server in browser. http://localhost:3000
and http://127.0.0.1:3000
never return the page. I have tried with port 30001
also, but in vain.
Edit3
I stopped my server, created a new rails project rails new myApp
, moved into folder myApp
and started the server. It asked me to do bundle install
because it couldn't find sqlite3 ruby
. I did so, and started the server and I was able to browse it through above URL.
I moved to my previous server folder and it still doesn't work. What could be wrong in this application?