I am using codeship.io for testing my Ruby on Rails app. In the 10th step I am getting the following error. What changes should I make in the database.yml file
rake aborted!
ActiveRecord::AdapterNotSpecified: database configuration does not specify adapter
/home/rof/cache/bundler/ruby/2.1.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/connection_specification.rb:52:in `resolve_hash_connection'
/home/rof/cache/bundler/ruby/2.1.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/connection_specification.rb:46:in `resolve_string_connection'
/home/rof/cache/bundler/ruby/2.1.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/connection_specification.rb:30:in `spec'
/home/rof/cache/bundler/ruby/2.1.0/gems/activerecord-4.0.0/lib/active_record/connection_handling.rb:39:in `establish_connection'
/home/rof/cache/bundler/ruby/2.1.0/gems/activerecord-4.0.0/lib/active_record/railtie.rb:175:in `block (2 levels) in <class:Railtie>'
/home/rof/cache/bundler/ruby/2.1.0/gems/activesupport-4.0.0/lib/active_support/lazy_load_hooks.rb:38:in `instance_eval'
/home/rof/cache/bundler/ruby/2.1.0/gems/activesupport-4.0.0/lib/active_support/lazy_load_hooks.rb:38:in `execute_hook'
/home/rof/cache/bundler/ruby/2.1.0/gems/activesupport-4.0.0/lib/active_support/lazy_load_hooks.rb:28:in `block in on_load'
/home/rof/cache/bundler/ruby/2.1.0/gems/activesupport-4.0.0/lib/active_support/lazy_load_hooks.rb:27:in `each'
/home/rof/cache/bundler/ruby/2.1.0/gems/activesupport-4.0.0/lib/active_support/lazy_load_hooks.rb:27:in `on_load'
/home/rof/cache/bundler/ruby/2.1.0/gems/activerecord-4.0.0/lib/active_record/railtie.rb:173:in `block in <class:Railtie>'
/home/rof/cache/bundler/ruby/2.1.0/gems/railties-4.0.0/lib/rails/initializable.rb:30:in `instance_exec'
/home/rof/cache/bundler/ruby/2.1.0/gems/railties-4.0.0/lib/rails/initializable.rb:30:in `run'
/home/rof/cache/bundler/ruby/2.1.0/gems/railties-4.0.0/lib/rails/initializable.rb:55:in `block in run_initializers'
/home/rof/cache/bundler/ruby/2.1.0/gems/railties-4.0.0/lib/rails/initializable.rb:54:in `run_initializers'
/home/rof/cache/bundler/ruby/2.1.0/gems/railties-4.0.0/lib/rails/application.rb:215:in `initialize!'
/home/rof/cache/bundler/ruby/2.1.0/gems/railties-4.0.0/lib/rails/railtie/configurable.rb:30:in `method_missing'
/home/rof/src/bitbucket.org/rahulv/luckily-beta/config/environment.rb:5:in `<top (required)>'
/home/rof/cache/bundler/ruby/2.1.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require'
/home/rof/cache/bundler/ruby/2.1.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `block in require'
/home/rof/cache/bundler/ruby/2.1.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:213:in `load_dependency'
/home/rof/cache/bundler/ruby/2.1.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require'
/home/rof/cache/bundler/ruby/2.1.0/gems/railties-4.0.0/lib/rails/application.rb:189:in `require_environment!'
/home/rof/cache/bundler/ruby/2.1.0/gems/railties-4.0.0/lib/rails/application.rb:249:in `block in run_tasks_blocks'
Tasks: TOP => db:schema:load => environment
(See full trace by running task with --trace)
database.yml
development:
adapter: mysql2
database: test_database
username: test_user
password: password
host: localhost
pool: 5
timeout: 5000
production:
adapter: mysql2
database: test_database
username: test_user
password: password
host: localhost
pool: 5
timeout: 5000
test:
adapter: mysql2
database: test_database
username: test_user
password: password
host: localhost
pool: 5
timeout: 5000
Related
Rails server doesn't starting in production environment, i think that there is a conflict with databases, should i migrate them or smth else?
=> Booting Puma
=> Rails 5.0.6 application starting in production on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
Exiting
/home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/activerecord-5.0.6/lib/active_record/connection_adapters/connection_specification.rb:170:in
`spec': database configuration does not specify adapter
(ActiveRecord::AdapterNotSpecified)
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/activerecord-5.0.6/lib/active_record/connection_handling.rb:53:in `establish_connection'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/activerecord-5.0.6/lib/active_record/railtie.rb:125:in `block (2 levels) in <class:Railtie>'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/activesupport-5.0.6/lib/active_support/lazy_load_hooks.rb:69:in `instance_eval'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/activesupport-5.0.6/lib/active_support/lazy_load_hooks.rb:69:in `block in execute_hook'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/activesupport-5.0.6/lib/active_support/lazy_load_hooks.rb:60:in `with_execution_control'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/activesupport-5.0.6/lib/active_support/lazy_load_hooks.rb:65:in `execute_hook'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/activesupport-5.0.6/lib/active_support/lazy_load_hooks.rb:41:in `block in on_load'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/activesupport-5.0.6/lib/active_support/lazy_load_hooks.rb:40:in `each'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/activesupport-5.0.6/lib/active_support/lazy_load_hooks.rb:40:in `on_load'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/activerecord-5.0.6/lib/active_record/railtie.rb:121:in `block in <class:Railtie>'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.0.6/lib/rails/initializable.rb:30:in `instance_exec'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.0.6/lib/rails/initializable.rb:30:in `run'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.0.6/lib/rails/initializable.rb:55:in `block in run_initializers'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/2.3.0/tsort.rb:228:in `block in tsort_each'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/2.3.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/2.3.0/tsort.rb:431:in `each_strongly_connected_component_from'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/2.3.0/tsort.rb:349:in `block in each_strongly_connected_component'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/2.3.0/tsort.rb:347:in `each'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/2.3.0/tsort.rb:347:in `call'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/2.3.0/tsort.rb:347:in `each_strongly_connected_component'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/2.3.0/tsort.rb:226:in `tsort_each'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/2.3.0/tsort.rb:205:in `tsort_each'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.0.6/lib/rails/initializable.rb:54:in `run_initializers'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.0.6/lib/rails/application.rb:352:in `initialize!'
from /home/user/Desktop/upgraded-carnival/config/environment.rb:5:in `<top (required)>'
from /home/user/Desktop/upgraded-carnival/config.ru:3:in `require_relative'
from /home/user/Desktop/upgraded-carnival/config.ru:3:in `block in <main>'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rack-2.0.3/lib/rack/builder.rb:55:in `instance_eval'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rack-2.0.3/lib/rack/builder.rb:55:in `initialize'
from /home/user/Desktop/upgraded-carnival/config.ru:in `new'
from /home/user/Desktop/upgraded-carnival/config.ru:in `<main>'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rack-2.0.3/lib/rack/builder.rb:49:in `eval'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rack-2.0.3/lib/rack/builder.rb:49:in `new_from_string'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rack-2.0.3/lib/rack/builder.rb:40:in `parse_file'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rack-2.0.3/lib/rack/server.rb:319:in `build_app_and_options_from_config'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rack-2.0.3/lib/rack/server.rb:219:in `app'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.0.6/lib/rails/commands/server.rb:84:in `app'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rack-2.0.3/lib/rack/server.rb:354:in `wrapped_app'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/rack-2.0.3/lib/rack/server.rb:283:in `start'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.0.6/lib/rails/commands/server.rb:104:in `start'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.0.6/lib/rails/commands/commands_tasks.rb:90:in `block in server'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.0.6/lib/rails/commands/commands_tasks.rb:85:in `tap'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.0.6/lib/rails/commands/commands_tasks.rb:85:in `server'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.0.6/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
from /home/user/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.0.6/lib/rails/commands.rb:18:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
My database.yml :
default: &default
adapter: postgresql
encoding: unicode
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
production:
host: localhost
database: magnetcoin_production
pool: 10
timeout: 10000
username: magnetcoin
password:
magnetcoin template: template0
development: <<: *default
database: magnetcoin_development
test: <<: *default
database: magnetcoin_test
As per you logs you did not define the adaptor for your production env database config. You added the adaptor in default block but did not import default to production block. Just import default block in production block and every thing works fine.
default: &default
adapter: postgresql
encoding: unicode
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
production: <<: *default
host: localhost
database: magnetcoin_production
pool: 10
timeout: 10000
username: magnetcoin
password: magnetcoin
template: template0
development: <<: *default
database: magnetcoin_development
test: <<: *default
database: magnetcoin_test
I need to change sqlite to mysql for work with ruby on rails, but as I am a newbie in this, I have a problem
The first that I did was to go a GemFile and include the mysql gem. I am working in local
localhost:3306 using LAMP
source 'https://rubygems.org'
gem 'rails', '3.2.19'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'mysql2'
gem 'hirb'
After I configurate the file database.yml
development:
adapter: mysql2
encoding: utf8
database: blog_development
pool: 5
username: root
password: strlen12
socket: /tmp/mysql.sock
test:
adapter: mysql2
encoding: utf8
database: blog_development
pool: 5
username: root
password: strlen12
socket: /tmp/mysql.sock
production:
adapter: mysql2
encoding: utf8
database: blog_development
pool: 5
username: root
password: strlen12
socket: /tmp/mysql.sock
but when I try to run rake db:migrate this error is triggered
fernando#fernando:~/ProyectoTicketMaster/TicketMaster$ rake db:migrate
rake aborted!
Mysql2::Error: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
/home/fernando/.rvm/gems/ruby-1.9.3-p547#ticket_master/gems/mysql2-0.3.17/lib/mysql2/client.rb:70:in `connect'
/home/fernando/.rvm/gems/ruby-1.9.3-p547#ticket_master/gems/mysql2-0.3.17/lib/mysql2/client.rb:70:in `initialize'
/home/fernando/.rvm/gems/ruby-1.9.3-p547#ticket_master/gems/activerecord-3.2.19/lib/active_record/connection_adapters/mysql2_adapter.rb:16:in `new'
/home/fernando/.rvm/gems/ruby-1.9.3-p547#ticket_master/gems/activerecord-3.2.19/lib/active_record/connection_adapters/mysql2_adapter.rb:16:in `mysql2_connection'
/home/fernando/.rvm/gems/ruby-1.9.3-p547#ticket_master/gems/activerecord-3.2.19/lib/active_record/connection_adapters/abstract/connection_pool.rb:315:in `new_connection'
/home/fernando/.rvm/gems/ruby-1.9.3-p547#ticket_master/gems/activerecord-3.2.19/lib/active_record/connection_adapters/abstract/connection_pool.rb:325:in `checkout_new_connection'
/home/fernando/.rvm/gems/ruby-1.9.3-p547#ticket_master/gems/activerecord-3.2.19/lib/active_record/connection_adapters/abstract/connection_pool.rb:247:in `block (2 levels) in checkout'
/home/fernando/.rvm/gems/ruby-1.9.3-p547#ticket_master/gems/activerecord-3.2.19/lib/active_record/connection_adapters/abstract/connection_pool.rb:242:in `loop'
/home/fernando/.rvm/gems/ruby-1.9.3-p547#ticket_master/gems/activerecord-3.2.19/lib/active_record/connection_adapters/abstract/connection_pool.rb:242:in `block in checkout'
/home/fernando/.rvm/gems/ruby-1.9.3-p547#ticket_master/gems/activerecord-3.2.19/lib/active_record/connection_adapters/abstract/connection_pool.rb:239:in `checkout'
/home/fernando/.rvm/gems/ruby-1.9.3-p547#ticket_master/gems/activerecord-3.2.19/lib/active_record/connection_adapters/abstract/connection_pool.rb:102:in `block in connection'
/home/fernando/.rvm/gems/ruby-1.9.3-p547#ticket_master/gems/activerecord-3.2.19/lib/active_record/connection_adapters/abstract/connection_pool.rb:101:in `connection'
/home/fernando/.rvm/gems/ruby-1.9.3-p547#ticket_master/gems/activerecord-3.2.19/lib/active_record/connection_adapters/abstract/connection_pool.rb:410:in `retrieve_connection'
/home/fernando/.rvm/gems/ruby-1.9.3-p547#ticket_master/gems/activerecord-3.2.19/lib/active_record/connection_adapters/abstract/connection_specification.rb:171:in `retrieve_connection'
/home/fernando/.rvm/gems/ruby-1.9.3-p547#ticket_master/gems/activerecord-3.2.19/lib/active_record/connection_adapters/abstract/connection_specification.rb:145:in `connection'
/home/fernando/.rvm/gems/ruby-1.9.3-p547#ticket_master/gems/activerecord-3.2.19/lib/active_record/model_schema.rb:310:in `clear_cache!'
/home/fernando/.rvm/gems/ruby-1.9.3-p547#ticket_master/gems/activerecord-3.2.19/lib/active_record/railtie.rb:103:in `block (2 levels) in <class:Railtie>'
/home/fernando/.rvm/gems/ruby-1.9.3-p547#ticket_master/gems/activesupport-3.2.19/lib/active_support/callbacks.rb:418:in `_run__875551666__prepare__678451887__callbacks'
/home/fernando/.rvm/gems/ruby-1.9.3-p547#ticket_master/gems/activesupport-3.2.19/lib/active_support/callbacks.rb:405:in `__run_callback'
/home/fernando/.rvm/gems/ruby-1.9.3-p547#ticket_master/gems/activesupport-3.2.19/lib/active_support/callbacks.rb:385:in `_run_prepare_callbacks'
/home/fernando/.rvm/gems/ruby-1.9.3-p547#ticket_master/gems/activesupport-3.2.19/lib/active_support/callbacks.rb:81:in `run_callbacks'
/home/fernando/.rvm/gems/ruby-1.9.3-p547#ticket_master/gems/actionpack-3.2.19/lib/action_dispatch/middleware/reloader.rb:74:in `prepare!'
/home/fernando/.rvm/gems/ruby-1.9.3-p547#ticket_master/gems/actionpack-3.2.19/lib/action_dispatch/middleware/reloader.rb:48:in `prepare!'
/home/fernando/.rvm/gems/ruby-1.9.3-p547#ticket_master/gems/railties-3.2.19/lib/rails/application/finisher.rb:47:in `block in <module:Finisher>'
/home/fernando/.rvm/gems/ruby-1.9.3-p547#ticket_master/gems/railties-3.2.19/lib/rails/initializable.rb:30:in `instance_exec'
/home/fernando/.rvm/gems/ruby-1.9.3-p547#ticket_master/gems/railties-3.2.19/lib/rails/initializable.rb:30:in `run'
/home/fernando/.rvm/gems/ruby-1.9.3-p547#ticket_master/gems/railties-3.2.19/lib/rails/initializable.rb:55:in `block in run_initializers'
/home/fernando/.rvm/gems/ruby-1.9.3-p547#ticket_master/gems/railties-3.2.19/lib/rails/initializable.rb:54:in `each'
/home/fernando/.rvm/gems/ruby-1.9.3-p547#ticket_master/gems/railties-3.2.19/lib/rails/initializable.rb:54:in `run_initializers'
/home/fernando/.rvm/gems/ruby-1.9.3-p547#ticket_master/gems/railties-3.2.19/lib/rails/application.rb:136:in `initialize!'
/home/fernando/.rvm/gems/ruby-1.9.3-p547#ticket_master/gems/railties-3.2.19/lib/rails/railtie/configurable.rb:30:in `method_missing'
/home/fernando/ProyectoTicketMaster/TicketMaster/config/environment.rb:5:in `<top (required)>'
/home/fernando/.rvm/gems/ruby-1.9.3-p547#ticket_master/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:251:in `require'
/home/fernando/.rvm/gems/ruby-1.9.3-p547#ticket_master/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:251:in `block in require'
/home/fernando/.rvm/gems/ruby-1.9.3-p547#ticket_master/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:236:in `load_dependency'
/home/fernando/.rvm/gems/ruby-1.9.3-p547#ticket_master/gems/activesupport-3.2.19/lib/active_support/dependencies.rb:251:in `require'
/home/fernando/.rvm/gems/ruby-1.9.3-p547#ticket_master/gems/railties-3.2.19/lib/rails/application.rb:103:in `require_environment!'
/home/fernando/.rvm/gems/ruby-1.9.3-p547#ticket_master/gems/railties-3.2.19/lib/rails/application.rb:305:in `block (2 levels) in initialize_tasks'
Tasks: TOP => db:migrate => environment
(See full trace by running task with --trace)
Version of Mysql installed in my pc
fernando#fernando:~/ProyectoTicketMaster/TicketMaster$ mysql --version
mysql Ver 14.14 Distrib 5.5.38, for debian-linux-gnu (i686) using readline 6.2
Check the socket path for MySQL in your file my.cnf (usually in the /etc/mysql/ folder) :
socket=/var/lib/mysql/mysql.sock
you can check if mysql is running with the following command:
mysqladmin -u root -p status
If you make any changes make sure you restart your server. Also you could use the localhost connection:
development:
adapter: mysql2
encoding: utf8
database: my_db_name
username: root
password: my_password
host: 127.0.0.1
port: 3306
Trouble installing gitlab-5.0
https://github.com/gitlabhq/gitlabhq/blob/5-0-stable/doc/install/installation.md#initialise-database-and-activate-advanced-features
root#ubuntu:/home/gitlab/gitlab# bundle exec rake gitlab:setup RAILS_ENV=production
rake aborted!
Access denied for user 'root'#'localhost' (using password: YES)
/home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/mysql2-0.3.11/lib/mysql2/client.rb:44:in `connect'
/home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/mysql2-0.3.11/lib/mysql2/client.rb:44:in `initialize'
/home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/connection_adapters/mysql2_adapter.rb:16:in `new'
/home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/connection_adapters/mysql2_adapter.rb:16:in `mysql2_connection'
/home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:315:in `new_connection'
/home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:325:in `checkout_new_connection'
/home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:247:in `block (2 levels) in checkout'
/home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:242:in `loop'
/home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:242:in `block in checkout'
/home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:239:in `checkout'
/home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:102:in `block in connection'
/home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:101:in `connection'
/home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:410:in `retrieve_connection'
/home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_specification.rb:171:in `retrieve_connection'
/home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_specification.rb:145:in `connection'
/home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/model_schema.rb:308:in `clear_cache!'
/home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/railtie.rb:104:in `block (2 levels) in <class:Railtie>'
/home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:418:in `_run__807030537706508428__prepare__2182945095053453794__callbacks'
/home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:405:in `__run_callback'
/home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:385:in `_run_prepare_callbacks'
/home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:81:in `run_callbacks'
/home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_dispatch/middleware/reloader.rb:74:in `prepare!'
/home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/action_dispatch/middleware/reloader.rb:48:in `prepare!'
/home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/application/finisher.rb:47:in `block in <module:Finisher>'
/home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/initializable.rb:30:in `instance_exec'
/home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/initializable.rb:30:in `run'
/home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/initializable.rb:55:in `block in run_initializers'
/home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/initializable.rb:54:in `each'
/home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/initializable.rb:54:in `run_initializers'
/home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/application.rb:136:in `initialize!'
/home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/railtie/configurable.rb:30:in `method_missing'
/home/gitlab/gitlab/config/environment.rb:5:in `<top (required)>'
/home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/backports-2.6.7/lib/backports/tools.rb:314:in `require'
/home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/backports-2.6.7/lib/backports/tools.rb:314:in `require_with_backports'
/home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `block in require'
/home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:236:in `load_dependency'
/home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require'
/home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/application.rb:103:in `require_environment!'
/home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/application.rb:297:in `block (2 levels) in initialize_tasks'
Tasks: TOP => gitlab:setup => environment
(See full trace by running task with --trace)
Some idea?
If you are following the tutorial and followed the steps for the MySQL database setup then you have configured the database to use gitlab for the user name.
# Create a user for GitLab. (change $password to a real password)
mysql> CREATE USER 'gitlab'#'localhost' IDENTIFIED BY '$password';
but if your database.yml file is attempting to log into the database using the root credentials.
production:
adapter: mysql2
encoding: utf8
reconnect: false
database: gitlabhq_production
pool: 5
username: root
password: "secure password"
# host: localhost
# socket: /tmp/mysql.sock
That is why you would see that error.
Change your database.yml file to reflect the login created in the database setup portion of the tutorial.
production:
adapter: mysql2
encoding: utf8
reconnect: false
database: gitlabhq_production
pool: 5
username: gitlab
password: "$password"
# host: localhost
# socket: /tmp/mysql.sock
That section Initialise Database and Activate Advanced Features is:
sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production
That means you are supposed to execute that command as git, not as root (which hasn't been granted access to the database).
Make sure though that your database.yml config file looks like this one (if you have mysql installed and want to use a mysql database).
production:
adapter: mysql2
encoding: utf8
reconnect: false
database: gitlabhq_production
pool: 5
username: root
password: "secure password"
# host: localhost
# socket: /tmp/mysql.sock
It does declare an access for an account root, but this is purely a declarative mysql account (nothing to do with the user root)
I'm trying to use mysql as a database in production enviroment as sugested on page 234, chapter 16 of my Agile 4rth edition. As far as I know that this question looks like the one that danymmc asked on january (http://stackoverflow.com/questions/8809099/rails-app-rake-dbmigrate-aborted-syntax-error) the solution doesn't fit to me.
I'm working with:
Ruby 1.9.2
Rails 3.1.0
rubygems 1.8.18
My database.yml is:
development:
adapter: sqlite3
database: development
pool: 5
timeout: 5000
production:
adapter: mysql
database: depot_production
encoding: utf8
host: localhost
password: password
pool: 5
reconnect: false
socket: /var/run/mysqld/mysqld.sock
username: username
test:
adapter: sqlite3
database: db/test.sqlite3
pool: 5
timeout: 5000
When I trace the rake db:setup RAILS_ENV="production" I get:
root#HAL3:/var/www/repos/depot/depot_old# rake db:setup RAILS_ENV="production" --trace
** Invoke db:setup (first_time)
** Invoke db:create (first_time)
** Invoke db:load_config (first_time)
** Invoke rails_env (first_time)
** Execute rails_env
** Execute db:load_config
rake aborted!
syntax error on line 1, col 9: ` adapter: sqlite3'
/usr/local/rvm/rubies/ruby-1.9.2-p318/lib/ruby/1.9.1/syck.rb:135:in `load'
/usr/local/rvm/rubies/ruby-1.9.2-p318/lib/ruby/1.9.1/syck.rb:135:in `load'
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/railties-3.1.0/lib/rails/application/configuration.rb:100:in `database_configuration'
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/activerecord-3.1.0/lib/active_record/railties/databases.rake:6:in `block (2 levels) in <top (required)>'
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `block in execute'
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
/usr/local/rvm/rubies/ruby-1.9.2-p318/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/task.rb:176:in `block in invoke_prerequisites'
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/task.rb:174:in `each'
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/task.rb:174:in `invoke_prerequisites'
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/task.rb:157:in `block in invoke_with_call_chain'
/usr/local/rvm/rubies/ruby-1.9.2-p318/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/task.rb:176:in `block in invoke_prerequisites'
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/task.rb:174:in `each'
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/task.rb:174:in `invoke_prerequisites'
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/task.rb:157:in `block in invoke_with_call_chain'
/usr/local/rvm/rubies/ruby-1.9.2-p318/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block (2 levels) in top_level'
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block in top_level'
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `block in run'
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>'
/usr/local/rvm/gems/ruby-1.9.2-p318/bin/rake:19:in `load'
/usr/local/rvm/gems/ruby-1.9.2-p318/bin/rake:19:in `<main>'
Tasks: TOP => db:setup => db:create => db:load_config
I tried to include this code to the config/boot.rb file and it doens't worked:
require 'yaml'
YAML::ENGINE.yamler = 'syck'
I tried to update my gems with
gem update -system
and it doesn't work too.
The most interesting thing is that my development machine and the production one are the same and, of course, in development (localhost:3000 with rails server up) works perfectly.
Any help will be appreciated.
Try with this database.yml:
development:
adapter: sqlite3
database: development
pool: 5
timeout: 5000
production:
adapter: mysql
database: depot_production
encoding: utf8
host: localhost
password: password
pool: 5
reconnect: false
socket: /var/run/mysqld/mysqld.sock
username: username
test:
adapter: sqlite3
database: db/test.sqlite3
pool: 5
timeout: 5000
Mind the spaces, that are significant
The issue could be that you have your test environment nested 1 space too deep causing invalid YML. Make sure it is indented 2 spaces rather than 3.
You can use hostname: instead of host in database.yml file.
I've been trying to get my rails stack set up for the longest time, and so far I've been able to get everything running, but I get this error when I try to run the rails console:
C:/Ruby192/lib/ruby/1.9.1/psych.rb:148:in `parse': couldn't parse YAML at line 8 column 0 (Psych::SyntaxError)
from C:/Ruby192/lib/ruby/1.9.1/psych.rb:148:in `parse_stream'
from C:/Ruby192/lib/ruby/1.9.1/psych.rb:119:in `parse'
from C:/Ruby192/lib/ruby/1.9.1/psych.rb:106:in `load'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.5.rc1/lib/rails/application/configuration.rb:88:in `database_configuration'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.0.5.rc1/lib/active_record/railtie.rb:58:in `block (2 levels) in <class:Railtie>'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-3.0.5.rc1/lib/active_support/lazy_load_hooks.rb:36:in `instance_eval'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-3.0.5.rc1/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-3.0.5.rc1/lib/active_support/lazy_load_hooks.rb:43:in `block in run_load_hooks'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-3.0.5.rc1/lib/active_support/lazy_load_hooks.rb:42:in `each'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-3.0.5.rc1/lib/active_support/lazy_load_hooks.rb:42:in `run_load_hooks'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.0.5.rc1/lib/active_record/base.rb:1900:in `<top (required)>'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.0.5.rc1/lib/active_record/railtie.rb:32:in `block in <class:Railtie>'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.5.rc1/lib/rails/railtie.rb:180:in `call'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.5.rc1/lib/rails/railtie.rb:180:in `each'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.5.rc1/lib/rails/railtie.rb:180:in `load_console'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.5.rc1/lib/rails/application.rb:154:in `block in load_console'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.5.rc1/lib/rails/application/railties.rb:11:in `each'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.5.rc1/lib/rails/application/railties.rb:11:in `all'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.5.rc1/lib/rails/application.rb:154:in `load_console'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.5.rc1/lib/rails/commands/console.rb:26:in `start'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.5.rc1/lib/rails/commands/console.rb:8:in `start'
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/railties-3.0.5.rc1/lib/rails/commands.rb:23:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
I saw various fixes online, but they didn't end up solving the problem. Just wondering if anyone else has this same issue or knows how to fix it. Thanks.
Database.yml:
# SQLite version 3.x
# gem install sqlite3
development:
adapter: mysql
database: shovell_development
pool: 5
timeout: 5000
username: root
password: randompassword12
host: localhost
# 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:
adapter: mysql
database: shovell_test
pool: 5
timeout: 5000
username: root
password: randompassword12
host: localhost
production:
adapter: mysql
database: shovell_production
pool: 5
timeout: 5000
username: root
password: randompassword12
host: localhost
The problem is with the formatting of your database.yml file. The lines under timeout: 5000 should not be indended, ie:
development:
adapter: mysql
database: shovell_development
pool: 5
timeout: 5000
username: root
password: randompassword12
host: localhost
username, password and host are indented too much. They should be indented the same as the other parameters under each enviroment name.
Just remove the spaces from left side of username, password and host to make it align and try.