i'm using ruby version 1.9.3 p448 and rails version 3.2.13
all of my gems are upto date.
i create a project with the following code rails new simple_cms -d mysql
but when I start rails server with code rails s / rails server
I got the following error
wasif#Bayaw:~/projects/Sites/simple_cms$ rails s
=> Booting WEBrick
=> Rails 3.2.13 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/home/wasif/.rvm/gems/ruby-1.9.3-p448/gems/mysql2-0.3.13/lib/mysql2/client.rb:58:in `connect': Access denied for user 'root'#'localhost' (using password: NO) (Mysql2::Error)
from /home/wasif/.rvm/gems/ruby-1.9.3-p448/gems/mysql2-0.3.13/lib/mysql2/client.rb:58:in `initialize'
from /home/wasif/.rvm/gems/ruby-1.9.3-p448/gems/activerecord-3.2.13/lib/active_record/connection_adapters/mysql2_adapter.rb:16:in `new'
from /home/wasif/.rvm/gems/ruby-1.9.3-p448/gems/activerecord-3.2.13/lib/active_record/connection_adapters/mysql2_adapter.rb:16:in `mysql2_connection'
from /home/wasif/.rvm/gems/ruby-1.9.3-p448/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:315:in `new_connection'
from /home/wasif/.rvm/gems/ruby-1.9.3-p448/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:325:in `checkout_new_connection'
from /home/wasif/.rvm/gems/ruby-1.9.3-p448/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:247:in `block (2 levels) in checkout'
from /home/wasif/.rvm/gems/ruby-1.9.3-p448/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:242:in `loop'
from /home/wasif/.rvm/gems/ruby-1.9.3-p448/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:242:in `block in checkout'
from /home/wasif/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
from /home/wasif/.rvm/gems/ruby-1.9.3-p448/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:239:in `checkout'
from /home/wasif/.rvm/gems/ruby-1.9.3-p448/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:102:in `block in connection'
from /home/wasif/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
from /home/wasif/.rvm/gems/ruby-1.9.3-p448/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:101:in `connection'
from /home/wasif/.rvm/gems/ruby-1.9.3-p448/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:410:in `retrieve_connection'
from /home/wasif/.rvm/gems/ruby-1.9.3-p448/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_specification.rb:171:in `retrieve_connection'
from /home/wasif/.rvm/gems/ruby-1.9.3-p448/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_specification.rb:145:in `connection'
from /home/wasif/.rvm/gems/ruby-1.9.3-p448/gems/activerecord-3.2.13/lib/active_record/railtie.rb:88:in `block in <class:Railtie>'
from /home/wasif/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.13/lib/rails/initializable.rb:30:in `instance_exec'
from /home/wasif/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.13/lib/rails/initializable.rb:30:in `run'
from /home/wasif/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.13/lib/rails/initializable.rb:55:in `block in run_initializers'
from /home/wasif/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.13/lib/rails/initializable.rb:54:in `each'
from /home/wasif/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.13/lib/rails/initializable.rb:54:in `run_initializers'
from /home/wasif/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.13/lib/rails/application.rb:136:in `initialize!'
from /home/wasif/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.13/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /home/wasif/projects/Sites/simple_cms/config/environment.rb:5:in `<top (required)>'
from /home/wasif/projects/Sites/simple_cms/config.ru:3:in `require'
from /home/wasif/projects/Sites/simple_cms/config.ru:3:in `block in <main>'
from /home/wasif/.rvm/gems/ruby-1.9.3-p448/gems/rack-1.4.5/lib/rack/builder.rb:51:in `instance_eval'
from /home/wasif/.rvm/gems/ruby-1.9.3-p448/gems/rack-1.4.5/lib/rack/builder.rb:51:in `initialize'
from /home/wasif/projects/Sites/simple_cms/config.ru:in `new'
from /home/wasif/projects/Sites/simple_cms/config.ru:in `<main>'
from /home/wasif/.rvm/gems/ruby-1.9.3-p448/gems/rack-1.4.5/lib/rack/builder.rb:40:in `eval'
from /home/wasif/.rvm/gems/ruby-1.9.3-p448/gems/rack-1.4.5/lib/rack/builder.rb:40:in `parse_file'
from /home/wasif/.rvm/gems/ruby-1.9.3-p448/gems/rack-1.4.5/lib/rack/server.rb:200:in `app'
from /home/wasif/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.13/lib/rails/commands/server.rb:46:in `app'
from /home/wasif/.rvm/gems/ruby-1.9.3-p448/gems/rack-1.4.5/lib/rack/server.rb:304:in `wrapped_app'
from /home/wasif/.rvm/gems/ruby-1.9.3-p448/gems/rack-1.4.5/lib/rack/server.rb:254:in `start'
from /home/wasif/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.13/lib/rails/commands/server.rb:70:in `start'
from /home/wasif/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.13/lib/rails/commands.rb:55:in `block in <top (required)>'
from /home/wasif/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.13/lib/rails/commands.rb:50:in `tap'
from /home/wasif/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.13/lib/rails/commands.rb:50:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
please help me how to resolve this error... thanks!
Looks like the password is not set.
In your database.yml you should specify the password for your DB. E.g: if you have set the password on your devlopment pc to: root, it should look like this:
development:
adapter: mysql2
encoding: utf8
reconnect: false
database: your_db_name
pool: 5
username: root
password: root
socket: 'depending on your os something like:' /tmp/mysql.sock
Also I recommend not to check this file into your VCS. Make a copy of it, call it database.example.yml and put in there your config and a placeholder for the password.
Related
I'm trying to run this application via cloud9.io. I'm not a programmer. Tried everything I could comprehend, but hit a dead end. I try to run the app, but it throw an error. Here is the output:
Digest::Digest is deprecated; use Digest
Auto-loading of `.env.development` will be removed in 1.0. See https://github.com/bkeepers/dotenv-deployment if you would like to continue using this feature.
=> Booting WEBrick
=> Rails 3.2.22 application starting in development on http://0.0.0.0:8080
=> Call with -d to detach
=> Ctrl-C to shutdown server
Connecting to database specified by database.yml
Exiting
/usr/local/rvm/gems/ruby-2.1.3/gems/doorkeeper-2.0.1/lib/doorkeeper/config.rb:29:in `rescue in check_for_missing_columns': uninitialized constant ActiveRecord::NoDatabaseError (NameError)
from /usr/local/rvm/gems/ruby-2.1.3/gems/doorkeeper-2.0.1/lib/doorkeeper/config.rb:21:in `check_for_missing_columns'
from /usr/local/rvm/gems/ruby-2.1.3/gems/doorkeeper-2.0.1/lib/doorkeeper/config.rb:11:in `configure'
from /home/ubuntu/workspace/config/initializers/doorkeeper.rb:6:in `<top (required)>'
from /usr/local/rvm/gems/ruby-2.1.3/gems/railties-3.2.22/lib/rails/engine.rb:593:in `block (2 levels) in <class:Engine>'
from /usr/local/rvm/gems/ruby-2.1.3/gems/railties-3.2.22/lib/rails/engine.rb:592:in `each'
from /usr/local/rvm/gems/ruby-2.1.3/gems/railties-3.2.22/lib/rails/engine.rb:592:in `block in <class:Engine>'
from /usr/local/rvm/gems/ruby-2.1.3/gems/railties-3.2.22/lib/rails/initializable.rb:30:in `instance_exec'
from /usr/local/rvm/gems/ruby-2.1.3/gems/railties-3.2.22/lib/rails/initializable.rb:30:in `run'
from /usr/local/rvm/gems/ruby-2.1.3/gems/railties-3.2.22/lib/rails/initializable.rb:55:in `block in run_initializers'
from /usr/local/rvm/gems/ruby-2.1.3/gems/railties-3.2.22/lib/rails/initializable.rb:54:in `each'
from /usr/local/rvm/gems/ruby-2.1.3/gems/railties-3.2.22/lib/rails/initializable.rb:54:in `run_initializers'
from /usr/local/rvm/gems/ruby-2.1.3/gems/railties-3.2.22/lib/rails/application.rb:136:in `initialize!'
from /usr/local/rvm/gems/ruby-2.1.3/gems/railties-3.2.22/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /home/ubuntu/workspace/config/environment.rb:5:in `<top (required)>'
from /home/ubuntu/workspace/config.ru:17:in `block in <main>'
from /usr/local/rvm/gems/ruby-2.1.3/gems/rack-1.4.7/lib/rack/builder.rb:51:in `instance_eval'
from /usr/local/rvm/gems/ruby-2.1.3/gems/rack-1.4.7/lib/rack/builder.rb:51:in `initialize'
from /home/ubuntu/workspace/config.ru:in `new'
from /home/ubuntu/workspace/config.ru:in `<main>'
from /usr/local/rvm/gems/ruby-2.1.3/gems/rack-1.4.7/lib/rack/builder.rb:40:in `eval'
from /usr/local/rvm/gems/ruby-2.1.3/gems/rack-1.4.7/lib/rack/builder.rb:40:in `parse_file'
from /usr/local/rvm/gems/ruby-2.1.3/gems/rack-1.4.7/lib/rack/server.rb:200:in `app'
from /usr/local/rvm/gems/ruby-2.1.3/gems/railties-3.2.22/lib/rails/commands/server.rb:46:in `app'
from /usr/local/rvm/gems/ruby-2.1.3/gems/rack-1.4.7/lib/rack/server.rb:304:in `wrapped_app'
from /usr/local/rvm/gems/ruby-2.1.3/gems/rack-1.4.7/lib/rack/server.rb:254:in `start'
from /usr/local/rvm/gems/ruby-2.1.3/gems/railties-3.2.22/lib/rails/commands/server.rb:70:in `start'
from /usr/local/rvm/gems/ruby-2.1.3/gems/railties-3.2.22/lib/rails/commands.rb:55:in `block in <top (required)>'
from /usr/local/rvm/gems/ruby-2.1.3/gems/railties-3.2.22/lib/rails/commands.rb:50:in `tap'
from /usr/local/rvm/gems/ruby-2.1.3/gems/railties-3.2.22/lib/rails/commands.rb:50:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
Process exited with code: 1
[K
Process exited with code: 1
Here's the contents of database.yml
development:
adapter: postgresql
encoding: utf8
database: bikereg
username: postgres
password: !q2w3e4r5t
pool: 5
test:
adapter: postgresql
database: bikereg_test
staging:
adapter: postgresql
database: bikereg_staging
production:
adapter: postgresql
database: bikereg_production
pool: 25
Any idea how to fix it?
I was having a rails application, and I want to deploy it in my new laptop ( with ruby and rails installed fresh).
After installing gems and all .. when i goto my rails application folder and ruby rails s
Error shows like :
/home/insane/.rvm/gems/ruby-2.1.0/gems/activerecord-3.2.11/lib/active_record/connection_adapters/postgresql_adapter.rb:1208:in `initialize': FATAL: role "insane" does not exist (PG::Error)
from /home/insane/.rvm/gems/ruby-2.1.0/gems/activerecord-3.2.11/lib/active_record/connection_adapters/postgresql_adapter.rb:1208:in `new'
from /home/insane/.rvm/gems/ruby-2.1.0/gems/activerecord-3.2.11/lib/active_record/connection_adapters/postgresql_adapter.rb:1208:in `connect'
from /home/insane/.rvm/gems/ruby-2.1.0/gems/activerecord-3.2.11/lib/active_record/connection_adapters/postgresql_adapter.rb:326:in `initialize'
from /home/insane/.rvm/gems/ruby-2.1.0/gems/activerecord-3.2.11/lib/active_record/connection_adapters/postgresql_adapter.rb:28:in `new'
from /home/insane/.rvm/gems/ruby-2.1.0/gems/activerecord-3.2.11/lib/active_record/connection_adapters/postgresql_adapter.rb:28:in `postgresql_connection'
from /home/insane/.rvm/gems/ruby-2.1.0/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connection_pool.rb:315:in `new_connection'
from /home/insane/.rvm/gems/ruby-2.1.0/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connection_pool.rb:325:in `checkout_new_connection'
from /home/insane/.rvm/gems/ruby-2.1.0/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connection_pool.rb:247:in `block (2 levels) in checkout'
from /home/insane/.rvm/gems/ruby-2.1.0/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connection_pool.rb:242:in `loop'
from /home/insane/.rvm/gems/ruby-2.1.0/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connection_pool.rb:242:in `block in checkout'
from /home/insane/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/monitor.rb:211:in `mon_synchronize'
from /home/insane/.rvm/gems/ruby-2.1.0/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connection_pool.rb:239:in `checkout'
from /home/insane/.rvm/gems/ruby-2.1.0/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connection_pool.rb:102:in `block in connection'
from /home/insane/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/monitor.rb:211:in `mon_synchronize'
from /home/insane/.rvm/gems/ruby-2.1.0/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connection_pool.rb:101:in `connection'
from /home/insane/.rvm/gems/ruby-2.1.0/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connection_pool.rb:410:in `retrieve_connection'
from /home/insane/.rvm/gems/ruby-2.1.0/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connection_specification.rb:171:in `retrieve_connection'
from /home/insane/.rvm/gems/ruby-2.1.0/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connection_specification.rb:145:in `connection'
from /home/insane/.rvm/gems/ruby-2.1.0/gems/activerecord-3.2.11/lib/active_record/model_schema.rb:308:in `clear_cache!'
from /home/insane/.rvm/gems/ruby-2.1.0/gems/activerecord-3.2.11/lib/active_record/railtie.rb:97:in `block (2 levels) in <class:Railtie>'
from /home/insane/.rvm/gems/ruby-2.1.0/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:418:in `_run__2015430698042624034__prepare__3529665547423141566__callbacks'
from /home/insane/.rvm/gems/ruby-2.1.0/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:405:in `__run_callback'
from /home/insane/.rvm/gems/ruby-2.1.0/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:385:in `_run_prepare_callbacks'
from /home/insane/.rvm/gems/ruby-2.1.0/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:81:in `run_callbacks'
from /home/insane/.rvm/gems/ruby-2.1.0/gems/actionpack-3.2.11/lib/action_dispatch/middleware/reloader.rb:74:in `prepare!'
from /home/insane/.rvm/gems/ruby-2.1.0/gems/actionpack-3.2.11/lib/action_dispatch/middleware/reloader.rb:48:in `prepare!'
from /home/insane/.rvm/gems/ruby-2.1.0/gems/railties-3.2.11/lib/rails/application/finisher.rb:47:in `block in <module:Finisher>'
from /home/insane/.rvm/gems/ruby-2.1.0/gems/railties-3.2.11/lib/rails/initializable.rb:30:in `instance_exec'
from /home/insane/.rvm/gems/ruby-2.1.0/gems/railties-3.2.11/lib/rails/initializable.rb:30:in `run'
from /home/insane/.rvm/gems/ruby-2.1.0/gems/railties-3.2.11/lib/rails/initializable.rb:55:in `block in run_initializers'
from /home/insane/.rvm/gems/ruby-2.1.0/gems/railties-3.2.11/lib/rails/initializable.rb:54:in `each'
from /home/insane/.rvm/gems/ruby-2.1.0/gems/railties-3.2.11/lib/rails/initializable.rb:54:in `run_initializers'
from /home/insane/.rvm/gems/ruby-2.1.0/gems/railties-3.2.11/lib/rails/application.rb:136:in `initialize!'
from /home/insane/.rvm/gems/ruby-2.1.0/gems/railties-3.2.11/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /home/insane/Rails/BACKUP/config/environment.rb:5:in `<top (required)>'
from /home/insane/.rvm/gems/ruby-2.1.0/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require'
from /home/insane/.rvm/gems/ruby-2.1.0/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `block in require'
from /home/insane/.rvm/gems/ruby-2.1.0/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:236:in `load_dependency'
from /home/insane/.rvm/gems/ruby-2.1.0/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require'
from /home/insane/Rails/BACKUP/config.ru:3:in `block in <main>'
from /home/insane/.rvm/gems/ruby-2.1.0/gems/rack-1.4.5/lib/rack/builder.rb:51:in `instance_eval'
from /home/insane/.rvm/gems/ruby-2.1.0/gems/rack-1.4.5/lib/rack/builder.rb:51:in `initialize'
from /home/insane/Rails/BACKUP/config.ru:in `new'
from /home/insane/Rails/BACKUP/config.ru:in `<main>'
from /home/insane/.rvm/gems/ruby-2.1.0/gems/rack-1.4.5/lib/rack/builder.rb:40:in `eval'
from /home/insane/.rvm/gems/ruby-2.1.0/gems/rack-1.4.5/lib/rack/builder.rb:40:in `parse_file'
from /home/insane/.rvm/gems/ruby-2.1.0/gems/rack-1.4.5/lib/rack/server.rb:200:in `app'
from /home/insane/.rvm/gems/ruby-2.1.0/gems/railties-3.2.11/lib/rails/commands/server.rb:46:in `app'
from /home/insane/.rvm/gems/ruby-2.1.0/gems/rack-1.4.5/lib/rack/server.rb:304:in `wrapped_app'
from /home/insane/.rvm/gems/ruby-2.1.0/gems/rack-1.4.5/lib/rack/server.rb:254:in `start'
from /home/insane/.rvm/gems/ruby-2.1.0/gems/railties-3.2.11/lib/rails/commands/server.rb:70:in `start'
from /home/insane/.rvm/gems/ruby-2.1.0/gems/railties-3.2.11/lib/rails/commands.rb:55:in `block in <top (required)>'
from /home/insane/.rvm/gems/ruby-2.1.0/gems/railties-3.2.11/lib/rails/commands.rb:50:in `tap'
from /home/insane/.rvm/gems/ruby-2.1.0/gems/railties-3.2.11/lib/rails/commands.rb:50:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
I have gone through the below link , but even it dint help saying /Rails/BACKUP$ createdb insane
createdb: could not connect to database postgres: FATAL: role "insane" does not exist
(postgreSQL error) FATAL: role "demo" does not exist (PG::Error)`
Please help
You need a user in the database named insane.
Open up a terminal and do the following
(the $ and psql> denote the terminal type, not commands that you type)
$ psql template1
psql> CREATE USER insane WITH PASSWORD 'some_password';
That should create the user for you. Alternatively, if this is on a dev machine, you can just use
psql> CREATE USER insane superuser;
That will create the user insane with all permissions.
NOTE
You may first need to be logged in as the postgres user.
$ sudo su postgres
<password for your account>
You will not see your password being typed.
Then you will be able to use the first set of commands above.
Hi I am new in Ruby on Rails.
I've installed Rails and everything was working fine.
Then I changed database from SQLite to Postgre (because Heroku don't support it),did git push to Heroku.Everything was fine.
But when I restarted my local repository,it showed me this(on local repo):
user~:$ rails server
=> Booting WEBrick
=> Rails 3.2.13 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/usr/lib/ruby/vendor_ruby/active_record/connection_adapters/postgresql_adapter.rb:1215:in `initialize': FATAL: role "roma" does not exist (PG::ConnectionBad)
from /usr/lib/ruby/vendor_ruby/active_record/connection_adapters/postgresql_adapter.rb:1215:in `new'
from /usr/lib/ruby/vendor_ruby/active_record/connection_adapters/postgresql_adapter.rb:1215:in `connect'
from /usr/lib/ruby/vendor_ruby/active_record/connection_adapters/postgresql_adapter.rb:323:in `initialize'
from /usr/lib/ruby/vendor_ruby/active_record/connection_adapters/postgresql_adapter.rb:27:in `new'
from /usr/lib/ruby/vendor_ruby/active_record/connection_adapters/postgresql_adapter.rb:27:in `postgresql_connection'
from /usr/lib/ruby/vendor_ruby/active_record/connection_adapters/abstract/connection_pool.rb:315:in `new_connection'
from /usr/lib/ruby/vendor_ruby/active_record/connection_adapters/abstract/connection_pool.rb:325:in `checkout_new_connection'
from /usr/lib/ruby/vendor_ruby/active_record/connection_adapters/abstract/connection_pool.rb:247:in `block (2 levels) in checkout'
from /usr/lib/ruby/vendor_ruby/active_record/connection_adapters/abstract/connection_pool.rb:242:in `loop'
from /usr/lib/ruby/vendor_ruby/active_record/connection_adapters/abstract/connection_pool.rb:242:in `block in checkout'
from /usr/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
from /usr/lib/ruby/vendor_ruby/active_record/connection_adapters/abstract/connection_pool.rb:239:in `checkout'
from /usr/lib/ruby/vendor_ruby/active_record/connection_adapters/abstract/connection_pool.rb:102:in `block in connection'
from /usr/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
from /usr/lib/ruby/vendor_ruby/active_record/connection_adapters/abstract/connection_pool.rb:101:in `connection'
from /usr/lib/ruby/vendor_ruby/active_record/connection_adapters/abstract/connection_pool.rb:410:in `retrieve_connection'
from /usr/lib/ruby/vendor_ruby/active_record/connection_adapters/abstract/connection_specification.rb:171:in `retrieve_connection'
from /usr/lib/ruby/vendor_ruby/active_record/connection_adapters/abstract/connection_specification.rb:145:in `connection'
from /usr/lib/ruby/vendor_ruby/active_record/railtie.rb:88:in `block in <class:Railtie>'
from /usr/lib/ruby/vendor_ruby/rails/initializable.rb:30:in `instance_exec'
from /usr/lib/ruby/vendor_ruby/rails/initializable.rb:30:in `run'
from /usr/lib/ruby/vendor_ruby/rails/initializable.rb:55:in `block in run_initializers'
from /usr/lib/ruby/vendor_ruby/rails/initializable.rb:54:in `each'
from /usr/lib/ruby/vendor_ruby/rails/initializable.rb:54:in `run_initializers'
from /usr/lib/ruby/vendor_ruby/rails/application.rb:136:in `initialize!'
from /usr/lib/ruby/vendor_ruby/rails/railtie/configurable.rb:30:in `method_missing'
from /home/roma/Templates/first_app/config/environment.rb:5:in `<top (required)>'
from /home/roma/Templates/first_app/config.ru:3:in `require'
from /home/roma/Templates/first_app/config.ru:3:in `block in <main>'
from /usr/lib/ruby/vendor_ruby/rack/builder.rb:55:in `instance_eval'
from /usr/lib/ruby/vendor_ruby/rack/builder.rb:55:in `initialize'
from /home/roma/Templates/first_app/config.ru:in `new'
from /home/roma/Templates/first_app/config.ru:in `<main>'
from /usr/lib/ruby/vendor_ruby/rack/builder.rb:49:in `eval'
from /usr/lib/ruby/vendor_ruby/rack/builder.rb:49:in `new_from_string'
from /usr/lib/ruby/vendor_ruby/rack/builder.rb:40:in `parse_file'
from /usr/lib/ruby/vendor_ruby/rack/server.rb:277:in `build_app_and_options_from_config'
from /usr/lib/ruby/vendor_ruby/rack/server.rb:199:in `app'
from /usr/lib/ruby/vendor_ruby/rails/commands/server.rb:46:in `app'
from /usr/lib/ruby/vendor_ruby/rack/server.rb:314:in `wrapped_app'
from /usr/lib/ruby/vendor_ruby/rack/server.rb:250:in `start'
from /usr/lib/ruby/vendor_ruby/rails/commands/server.rb:70:in `start'
from /usr/lib/ruby/vendor_ruby/rails/commands.rb:55:in `block in <top (required)>'
from /usr/lib/ruby/vendor_ruby/rails/commands.rb:50:in `tap'
from /usr/lib/ruby/vendor_ruby/rails/commands.rb:50:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
What can be cause of that?
Sorry for bad English.
In addition this is my database.yml file
development:
adapter: postgresql
database: my_database_development
pool: 5
timeout: 5000
test:
adapter: postgresql
database: my_database_development
pool: 5
timeout: 5000
production:
adapter: postgresql
database: my_database_development
pool: 5
timeout: 5000
Based on your error, you need to make a the user roma for your rails server to use to connect to your database. You can do this by using createuser to make your user defined in your database.yml. You may need to first do:
sudo su - postgres
createuser -P -s -e {your_machine_username}
but only if createuser throws an error with a normal createuser -P -s -e {user_defined_in_databaseyml}.
Then you can exit that user (exit will drop su) and do:
createuser -P -s -e {user_defined_in_databaseyml}
Then you should be able to rails s just fine (make sure you rake your db related tasks first).
Just starting to get into RoR development and I am struggling with getting the Webrick server to start. I am in my rails project's folder. Then I enter rails server or rails s and it looks like the server is going to start then it says Exiting with a bunch of other stuff listed below it. Anyone know what is wrong?? Here is what terminal spits out...
wyep:simple_cms designer1$ rails s
=> Booting WEBrick
=> Rails 3.2.13 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/mysql2-0.3.11/lib/mysql2/client.rb:44:in `connect': Access denied for user 'root'#'localhost' (using password: NO) (Mysql2::Error)
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/mysql2-0.3.11/lib/mysql2/client.rb:44:in `initialize'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/activerecord-3.2.13/lib/active_record/connection_adapters/mysql2_adapter.rb:16:in `new'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/activerecord-3.2.13/lib/active_record/connection_adapters/mysql2_adapter.rb:16:in `mysql2_connection'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:315:in `new_connection'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:325:in `checkout_new_connection'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:247:in `block (2 levels) in checkout'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:242:in `loop'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:242:in `block in checkout'
from /Users/designer1/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:239:in `checkout' from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:102:in `block in connection'
from /Users/designer1/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:101:in `connection'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:410:in `retrieve_connection'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_specification.rb:171:in `retrieve_connection'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_specification.rb:145:in `connection'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/activerecord-3.2.13/lib/active_record/railtie.rb:88:in `block in <class:Railtie>'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/railties-3.2.13/lib/rails/initializable.rb:30:in `instance_exec'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/railties-3.2.13/lib/rails/initializable.rb:30:in `run'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/railties-3.2.13/lib/rails/initializable.rb:55:in `block in run_initializers'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/railties-3.2.13/lib/rails/initializable.rb:54:in `each'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/railties-3.2.13/lib/rails/initializable.rb:54:in `run_initializers'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/railties-3.2.13/lib/rails/application.rb:136:in `initialize!'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/railties-3.2.13/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /Applications/MAMP/htdocs/simple_cms/config/environment.rb:5:in `<top (required)>'
from /Applications/MAMP/htdocs/simple_cms/config.ru:3:in `require'
from /Applications/MAMP/htdocs/simple_cms/config.ru:3:in `block in <main>'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/rack-1.4.5/lib/rack/builder.rb:51:in `instance_eval'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/rack-1.4.5/lib/rack/builder.rb:51:in `initialize'
from /Applications/MAMP/htdocs/simple_cms/config.ru:in `new'
from /Applications/MAMP/htdocs/simple_cms/config.ru:in `<main>'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/rack-1.4.5/lib/rack/builder.rb:40:in `eval'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/rack-1.4.5/lib/rack/builder.rb:40:in `parse_file'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/rack-1.4.5/lib/rack/server.rb:200:in `app'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/railties-3.2.13/lib/rails/commands/server.rb:46:in `app'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/rack-1.4.5/lib/rack/server.rb:304:in `wrapped_app'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/rack-1.4.5/lib/rack/server.rb:254:in `start'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/railties-3.2.13/lib/rails/commands/server.rb:70:in `start'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/railties-3.2.13/lib/rails/commands.rb:55:in `block in <top (required)>'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/railties-3.2.13/lib/rails/commands.rb:50:in `tap'
from /Users/designer1/.rvm/gems/ruby-2.0.0-p195/gems/railties-3.2.13/lib/rails/commands.rb:50:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
Error is in the message there:
Access denied for user 'root'#'localhost' (using password: NO) (Mysql2::Error)
In your config/database.yml you need to specify a valid host, user and password
So I've just installed postgreSQL with HomeBrew and have initialized my new demo_app with the: rails new demo_app -d postgresql command.
Albeit, I am getting the following error when starting up the server rails s.
Snippit:
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.13/lib/active_record/connection_adapters/postgresql_adapter.rb:1216:in `initialize': FATAL: role "demo" does not exist (PG::Error)
Full log:
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.13/lib/active_record/connection_adapters/postgresql_adapter.rb:1216:in `initialize': FATAL: role "demo" does not exist (PG::Error)
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.13/lib/active_record/connection_adapters/postgresql_adapter.rb:1216:in `new'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.13/lib/active_record/connection_adapters/postgresql_adapter.rb:1216:in `connect'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.13/lib/active_record/connection_adapters/postgresql_adapter.rb:324:in `initialize'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.13/lib/active_record/connection_adapters/postgresql_adapter.rb:28:in `new'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.13/lib/active_record/connection_adapters/postgresql_adapter.rb:28:in `postgresql_connection'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:315:in `new_connection'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:325:in `checkout_new_connection'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:247:in `block (2 levels) in checkout'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:242:in `loop'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:242:in `block in checkout'
from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:239:in `checkout'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:102:in `block in connection'
from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:101:in `connection'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:410:in `retrieve_connection'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_specification.rb:171:in `retrieve_connection'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_specification.rb:145:in `connection'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.13/lib/active_record/railtie.rb:88:in `block in <class:Railtie>'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.13/lib/rails/initializable.rb:30:in `instance_exec'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.13/lib/rails/initializable.rb:30:in `run'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.13/lib/rails/initializable.rb:55:in `block in run_initializers'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.13/lib/rails/initializable.rb:54:in `each'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.13/lib/rails/initializable.rb:54:in `run_initializers'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.13/lib/rails/application.rb:136:in `initialize!'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.13/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /Users/anthonypanepinto/Sites/new_demo/demo/config/environment.rb:5:in `<top (required)>'
from /Users/anthonypanepinto/Sites/new_demo/demo/config.ru:3:in `require'
from /Users/anthonypanepinto/Sites/new_demo/demo/config.ru:3:in `block in <main>'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/rack-1.4.5/lib/rack/builder.rb:51:in `instance_eval'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/rack-1.4.5/lib/rack/builder.rb:51:in `initialize'
from /Users/anthonypanepinto/Sites/new_demo/demo/config.ru:in `new'
from /Users/anthonypanepinto/Sites/new_demo/demo/config.ru:in `<main>'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/rack-1.4.5/lib/rack/builder.rb:40:in `eval'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/rack-1.4.5/lib/rack/builder.rb:40:in `parse_file'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/rack-1.4.5/lib/rack/server.rb:200:in `app'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.13/lib/rails/commands/server.rb:46:in `app'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/rack-1.4.5/lib/rack/server.rb:304:in `wrapped_app'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/rack-1.4.5/lib/rack/server.rb:254:in `start'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.13/lib/rails/commands/server.rb:70:in `start'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.13/lib/rails/commands.rb:55:in `block in <top (required)>'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.13/lib/rails/commands.rb:50:in `tap'
from /usr/local/rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.13/lib/rails/commands.rb:50:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
When your create rails app, you must create a database with postgres for that it works.
createdb demo
And check your config/database.yml