mardi 8 septembre 2015

Rails,Dont connect to database mysql2

I can't connect to the database in mysql. Gem file:

gem 'rails', '3.2.13'
gem 'mysql2'

in config/database.yml

development:
adapter: mysql2
encoding: utf8
reconnect: false
database: local
pool: 5
username: root
password: 123
host: localhost

test: &test
adapter: mysql2
encoding: utf8
reconnect: false
database:  local_test
pool: 5
username: root
password: 123
host: localhost

production:
adapter: mysql2
encoding: utf8
reconnect: false
database:  local_development
pool: 5
username: root
password: 123
host: localhost

cucumber:
<<: *test

When i run server. Error : "ActiveRecord::ConnectionNotEstablished (ActiveRecord::ConnectionNotEstablished) "


/home/kop/.rvm/gems/ruby-2.1.3@rails3213/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:410:in retrieve_connection': ActiveRecord::ConnectionNotEstablished (ActiveRecord::ConnectionNotEstablished)
    from /home/kop/.rvm/gems/ruby-2.1.3@rails3213/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_specification.rb:171:inretrieve_connection'
    from /home/kop/.rvm/gems/ruby-2.1.3@rails3213/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_specification.rb:145:in connection'
    from /home/kop/.rvm/gems/ruby-2.1.3@rails3213/gems/activerecord-3.2.13/lib/active_record/model_schema.rb:223:intable_exists?'
    from /home/kop/.rvm/gems/ruby-2.1.3@rails3213/gems/attr_encrypted-1.3.4/lib/attr_encrypted/adapters/active_record.rb:59:in attribute_instance_methods_as_symbols'
    from /home/kop/.rvm/gems/ruby-2.1.3@rails3213/gems/attr_encrypted-1.3.4/lib/attr_encrypted.rb:130:inblock in attr_encrypted'
    from /home/kop/.rvm/gems/ruby-2.1.3@rails3213/gems/attr_encrypted-1.3.4/lib/attr_encrypted.rb:125:in each'
    from /home/kop/.rvm/gems/ruby-2.1.3@rails3213/gems/attr_encrypted-1.3.4/lib/attr_encrypted.rb:125:inattr_encrypted'
    from /home/kop/.rvm/gems/ruby-2.1.3@rails3213/gems/attr_encrypted-1.3.4/lib/attr_encrypted/adapters/active_record.rb:51:in attr_encrypted'
    from /home/kop/rails/howtobuyafranchise/lib/franchise_core/lib/models/billing_info.rb:6:in'
    from /home/kop/rails/howtobuyafranchise/lib/franchise_core/lib/models/billing_info.rb:2:in <top (required)>'
    from /home/kop/.rvm/gems/ruby-2.1.3@rails3213/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:inrequire'
    from /home/kop/.rvm/gems/ruby-2.1.3@rails3213/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in block in require'
    from /home/kop/.rvm/gems/ruby-2.1.3@rails3213/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:236:inload_dependency'
    from /home/kop/.rvm/gems/ruby-2.1.3@rails3213/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in require'
    from /home/kop/rails/howtobuyafranchise/lib/franchise_core/lib/franchise.rb:35:in'
    from /home/kop/.rvm/gems/ruby-2.1.3@rails3213/gems/bundler-1.10.6/lib/bundler/runtime.rb:76:in require'
    from /home/kop/.rvm/gems/ruby-2.1.3@rails3213/gems/bundler-1.10.6/lib/bundler/runtime.rb:76:inblock (2 levels) in require'
    from /home/kop/.rvm/gems/ruby-2.1.3@rails3213/gems/bundler-1.10.6/lib/bundler/runtime.rb:72:in each'
    from /home/kop/.rvm/gems/ruby-2.1.3@rails3213/gems/bundler-1.10.6/lib/bundler/runtime.rb:72:inblock in require'
    from /home/kop/.rvm/gems/ruby-2.1.3@rails3213/gems/bundler-1.10.6/lib/bundler/runtime.rb:61:in each'
    from /home/kop/.rvm/gems/ruby-2.1.3@rails3213/gems/bundler-1.10.6/lib/bundler/runtime.rb:61:inrequire'
    from /home/kop/.rvm/gems/ruby-2.1.3@rails3213/gems/bundler-1.10.6/lib/bundler.rb:134:in require'
    from /home/kop/rails/howtobuyafranchise/config/application.rb:7:in'
    from /home/kop/.rvm/gems/ruby-2.1.3@rails3213/gems/railties-3.2.13/lib/rails/commands.rb:53:in require'
    from /home/kop/.rvm/gems/ruby-2.1.3@rails3213/gems/railties-3.2.13/lib/rails/commands.rb:53:inblock in '
    from /home/kop/.rvm/gems/ruby-2.1.3@rails3213/gems/railties-3.2.13/lib/rails/commands.rb:50:in tap'
    from /home/kop/.rvm/gems/ruby-2.1.3@rails3213/gems/railties-3.2.13/lib/rails/commands.rb:50:in'
    from script/rails:6:in require'
    from script/rails:6:in'
kop@ubuntu:~/rails/howtobuyafranchise$ 

Although a different project can connect to this database.

Aucun commentaire:

Enregistrer un commentaire