简体   繁体   中英

rake db:create:all

I apologize in advance for my ignorance, but I'm having this problem when I run

"rake db:create:all"

in my terminal.

NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01.
Gem.source_index called from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler/shared_helpers.rb:3.
NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01.
Gem.source_index called from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler/source.rb:162.
NOTE: Gem::SourceIndex#each is deprecated with no replacement. It will be removed on or after 2011-11-01.
Gem::SourceIndex#each called from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler/source.rb:162.
NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01.
Gem.source_index called from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler/shared_helpers.rb:84.
WARNING: This version of mysql2 (0.3.7) doesn't ship with the ActiveRecord adapter bundled anymore as it's now part of Rails 3.1
WARNING: Please use the 0.2.x releases if you plan on using it in Rails <= 3.0.x
WARNING: 'require 'rake/rdoctask'' is deprecated.  Please use 'require 'rdoc/task' (in RDoc 2.4.2+)' instead.
    at /usr/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/rdoctask.rb
Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
Couldn't create database for {"username"=>"root", "adapter"=>"mysql", "database"=>"testApp", "host"=>"localhost", "password"=>"mysql"}, charset: utf8, collation: utf8_unicode_ci
Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
Couldn't create database for {"username"=>"root", "adapter"=>"mysql", "database"=>"testApp", "host"=>"localhost", "password"=>"mysql"}, charset: utf8, collation: utf8_unicode_ci

i followed Leonid Shevtsov

My second question: When I bundle update it goes like this:

NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01.
Gem.source_index called from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler/shared_helpers.rb:3.
NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01.
Gem.source_index called from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler/source.rb:162.
NOTE: Gem::SourceIndex#each is deprecated with no replacement. It will be removed on or after 2011-11-01.
Gem::SourceIndex#each called from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler/source.rb:162.
NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01.
Gem.source_index called from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler/source.rb:162.
NOTE: Gem::SourceIndex#each is deprecated with no replacement. It will be removed on or after 2011-11-01.
Gem::SourceIndex#each called from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler/source.rb:162.
Fetching source index for http://rubygems.org/
Enter your password to install the bundled RubyGems to your system: 
/usr/lib/ruby/site_ruby/1.8/rubygems/package/tar_input.rb:122:in `initialize': no metadata found in /usr/lib/ruby/gems/1.8/cache/rake-0.9.2.2.gem (Gem::Package::FormatError)
    from /usr/lib/ruby/site_ruby/1.8/rubygems/package/tar_input.rb:20:in `new'
    from /usr/lib/ruby/site_ruby/1.8/rubygems/package/tar_input.rb:20:in `open'
    from /usr/lib/ruby/site_ruby/1.8/rubygems/package.rb:44:in `open'
    from /usr/lib/ruby/site_ruby/1.8/rubygems/format.rb:62:in `from_io'
    from /usr/lib/ruby/site_ruby/1.8/rubygems/format.rb:46:in `from_file_by_path'
    from /usr/lib/ruby/1.8/open-uri.rb:32:in `open_uri_original_open'
    from /usr/lib/ruby/1.8/open-uri.rb:32:in `open'
    from /usr/lib/ruby/site_ruby/1.8/rubygems/format.rb:45:in `from_file_by_path'
    from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler/source.rb:73:in `fetch'
    from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler/installer.rb:45:in `run'
    from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler/spec_set.rb:12:in `each'
    from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler/spec_set.rb:12:in `each'
    from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler/installer.rb:44:in `run'
    from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler/installer.rb:8:in `install'
    from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler/cli.rb:226:in `install'
    from /usr/lib/ruby/gems/1.8/gems/thor-0.14.6/lib/thor/task.rb:22:in `send'
    from /usr/lib/ruby/gems/1.8/gems/thor-0.14.6/lib/thor/task.rb:22:in `run'
    from /usr/lib/ruby/gems/1.8/gems/thor-0.14.6/lib/thor/invocation.rb:118:in `invoke_task'
    from /usr/lib/ruby/gems/1.8/gems/thor-0.14.6/lib/thor.rb:263:in `dispatch'
    from /usr/lib/ruby/gems/1.8/gems/thor-0.14.6/lib/thor/base.rb:389:in `start'
    from /usr/lib/ruby/gems/1.8/gems/bundler-1.0.10/bin/bundle:13
    from /usr/bin/bundle:19:in `load'
    from /usr/bin/bundle:19'

I can't seem to run bundle update without errors. I'm running my machine with Fedora 15 and a Mysql 5.5.

Thanks and again, I apologize for my ignorance; I'm a newbie to Rails.

Thanks in advance! :)

Looks like you should limit mysql2 version in your Gemfile:

gem 'mysql2', '~>0.2.0'

[EDIT] ...and then do a bundle install , of course

And as we can see in the logs, i think you have specified mysql as the adapter in your config/database.yml

change it to :

  adapter: mysql2

EDIT:

about your FormatError, i know i have to use :

bundle exec rake db:<command>

in order to execute rake now, can you try this ?

EDIT 2 :

Well, i suggest you use RVM to setup your project using ruby 1.9.2. Read RVM Doc for an easy guide how to do it.

Then do a bundle install

After that, make sure you do:

ruby -v

it should be 1.9.2

then retry your db:create like this:

bundle exec rake db:create:all

Hope it will finally works. ;-)

To get rid of the rubygems deprecation warnings update to the latest RubyGems version and run

gem pristine --all --no-extensions .

As for your mysql errors. Make sure you have MySQL service/daemon turned on and make sure your database.yml config file is correct.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM