Hi friends am trying to bring spree commerce but i got error while am trying this command on windows 7 spree install
I got an error like this please help me ..
C:/Ruby193/lib/ruby/1.9.1/psych.rb:203:in `parse': (<unknown>): could not find
expected ':' while scanning a simple key at line 17 column 3 (Psych::SyntaxError)
should have single space after : in database.yml, for each line example
development:
adapter: mysql
encoding: utf8
reconnect: false
database: form_dev
pool: 5
username: user
password: password
host: localhost
Related
I have a Rails app that has been using sqlite3 for the DB. Deployed to Heroku. Then find out that Heroku recommends switching to PostgreSQL. So now I'm trying to switch over without any luck. Was trying to use this Railscasts video for help.
I installed Homebrew. Installed PostgreSQL via Homebrew. After installation, there was no mention of creating a username or password for postgres.
I edited my Gemfile to
gem 'pg'
for both production and development and did bundle install.
I edited my database.yml file to this:
development:
adapter: postgresql
database: isement_dev
encoding: unicode
pool: 5
timeout: 5000
test:
adapter: postgresql
database: isement_test
encoding: unicode
pool: 5
timeout: 5000
production:
adapter: postgresql
database: isement_production
encoding: unicode
pool: 5
timeout: 5000
Like Ryan says to do in the video, I try this command:
rake db:create:all
Only to get this error:
could not connect to server: Permission denied
Is the server running locally and accepting
connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?
I do some more searching, and see that some tutorials show username and password included in the database.yml file. I then find out how to setup a user for Postgresql
After entering in the command $ createuser joe, I was never given the options that the docs say you'll be asked. Such as "Shall the new role be a superuser? (y/n)" So really not sure if the user was created, but there wasn't any errors either.
So, I'm assuming, after creating the user "joe", I reedited my database.yml file to include the user field I just created:
development:
adapter: postgresql
database: isement_dev
encoding: unicode
pool: 5
timeout: 5000
username: joe
password:
test:
adapter: postgresql
database: isement_test
encoding: unicode
pool: 5
timeout: 5000
Only to still get the same error of not being able to connect.
I've ran the command
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
to make sure the server is running as well.
Just in case it's needed, when I run
which psql
I receive this:
/usr/local/bin/psql
Is there something that I'm missing? The "database name" part of the database.yml file. This is supposed to be a database already created somewhere, or does this file create the database when I run the rake db:create:all command? I'm assuming the latter, so the name of the database doesn't matter?
Lazy option: Add host: localhost to your database.yml.
Only slightly less lazy option: Uninstall and reinstall the pg gem.
What's going on here? There are a number of ways for Postgres to already exist on your system, and the pg gem will use their pg_config output and build for their needs if you install the gem before installing your own copy of Postgres.
In your case, it was built for the version included with some releases of Mac OS X, which uses a socket file at /var/pgsql_socket.
when you are installing Postgres via Homebrew it will add your username to postgres with an empty password.
Just open a command prompt and type
whoami
Then change your database.yml to your mac user name (whatever is returned from whoami) with empty password.
Maybe add host: localhost
to you database.yml
My ruby on rails app contains two database connection and its working good in localhost, but its not working on heroku. Getting this error
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.2/lib/active_record/connection_adapters/connection_specification.rb:52:in 'resolve_hash_connection': database configuration does not specify adapter (ActiveRecord::AdapterNotSpecified)
database.yml
production:
adapter: mysql2
encoding: unicode
database: first_database
pool: 5
username: root
password:
production:
adapter: mysql2
encoding: unicode
database: second_database
pool: 5
username: root
password:
Since heroku overwrites default database.yml file, I followed this tutorial https://roratmindfiresolutions.wordpress.com/2013/05/27/connect-to-remote-database-server-from-heroku to setup multiple database connection on heroku, but still no change. I am using rails 4.0.1 . Any helps and suggestions are really appreciable. Thanks.
Note that in his YAML file he calls them production and production_sec whereas you're using production twice.
I don't know what to do. Try to use command
$ rails g migration vacancy
but this command give me error:
invoke active_record
/home/proger/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/psych.rb:203:in `parse': (<unknown>): mapping values are not allowed in this context at line 21 column 11 (Psych::SyntaxError)
from /home/proger/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/psych.rb:203:in `parse_stream'
from /home/proger/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/psych.rb:151:in `parse'
...
There are many rows in error code
I don't know how to fix that Thanks
UPDATE
development:
adapter: mysql2
encoding: utf8
reconnect: false
database: jobs
pool: 5
username: root
password: toor
socket: /var/run/mysqld/mysqld.sock
update:
with sqlite3 there is no problem. problem in mysql gem
It seems that you have syntax error in yaml file. Probably it is in config/database.yml
Just setup a new rails 3.1.3 app using mysql (mysql2 gem) on CentOS 5 server / apache / passenger... I have correctly setup a database and a user for that database and I have added the login and info into my database.yml file... I can generate stuff, and rake db:migrate ok but the "We're sorry, but something went wrong." message is being rendered in the browser and this message is showing up in my production.log file!
Started GET "/" for xx.xxx.xx.xxx at 2011-12-29 19:52:35 -0600
Mysql2::Error (Access denied for user 'root'#'localhost' (using password: NO)):
weird, I am not using "root" as the login info in database.yml... Any suggestions?
development:
adapter: mysql2
encoding: utf8
reconnect: false
database: the_db_I_made
pool: 5
username: the_user_I_made
password: the_password
socket: /var/lib/mysql/mysql.sock
production:
adapter: mysql2
encoding: utf8
reconnect: false
database: the_db_I_made
pool: 5
username: the_user_I_made
password: the_password
socket: /var/lib/mysql/mysql.sock
Bunch of questions / suggestions:
Can you connect to the database using the terminal?
mysql -u root -p
Also, have you tried this on development mode? If so, please share the results.
Try removing
socket: /var/lib/mysql/mysql.sock
Is the gem installation correct?
gem check mysql2
EDIT:
There is a lot of difference in development and production mode ( including but not limited to, environment variables like the database connection string, asset pre-compilation, different level of logging, custom debug info on error pages )
** Embarrassing!!**
You have not included the "host" property in your config!
Try this:
production:
adapter: mysql2
encoding: utf8
reconnect: false
host: your_host #<----- normally localhost
database: the_db_I_made
pool: 5
username: the_user_I_made
password: the_password
socket: /var/lib/mysql/mysql.sock
Ok, I guess this is all part of my learning curve :)
What it ended up being was this: The gem for passenger that I installed originally was version 3.0.9, I did a gem update --system and that installed version 3.0.11. So the server thought it was using version 3.0.11 and I was still pointing to libraries for 3.0.9 in my rails_server.conf file. I found how to upgrade on http://blog.phusion.nl/
In Ubuntu 1)/usr/bin/mysql_secure_installation 2) Run in Terminal
follow the steps carefully change the mysql password
here.Everything done .then go to database.yml change the password
previously what u have created. Run rails server and check the
application .. it will works
Did you create the database "the_db_I_made"?
First create it, then only run it, else it will show this error continuously.
Now try to tun it.
For Me It was giving error because of no database. So i created one Using :
$ rake db:create
And the problem was solved :D
Hello friends I am newbie in Rails.I installed rails in my ubuntu 10.10. As per my project requirement I installed
spree.Then I made application using command
rails new mystore
then I created the store application, switched to its folder to continue work directly in that application with command
$ cd mystore
then I made install spree_sample by the command
rake spree_sample:install
After that I made populating my database with this command then it showed error like this
rake aborted!
syntax error on line 20, col -1: `test:
adapter: mysql2
encoding: utf8
reconnect: false
database: mystore_test
pool: 5
username: root
password:root
production:
adapter: mysql2
encoding: utf8
reconnect: false
database: mystore_production
pool: 5
username: root
password:root
I was using this site for reference.Just have a look on it.I want to make spree commerce in ruby on rails.So please help me.I am newbie to rails.
You have syntax error in your database.yml config file. That's not related to Spree or to Ruby.
Should be "password: root" instead of "password:root"