hi , I have started to learn ruby on rails and I’m an absolute
beginner . when I try to rake a database like "rake db:schema:dump " I
get this message :
"rake aborted !
unknown database ‘cms_development’ "
although I have modified my database.yml and have created my database
before.
I’ll be appreciated if someone can help me with this
thanks
On Sat, Jul 16, 2011 at 12:44 AM, smtabatabaie
[email protected] wrote:
hi , I have started to learn ruby on rails and I’m an absolute
beginner . when I try to rake a database like "rake db:schema:dump " I
get this message :
"rake aborted !
unknown database ‘cms_development’ "
although I have modified my database.yml and have created my database
before.
To confirm that the DB in question exists: can you access it directly
from the console, using the same name/username/password that’s
in config/database.yml ?
–
Hassan S. ------------------------ [email protected]
twitter: @hassan
yes I can access it with the username and password in database.yml
without any problem
On Jul 16, 6:24pm, Hassan S. [email protected]
On 16 July 2011 08:44, smtabatabaie [email protected]
wrote:
hi , I have started to learn ruby on rails and I’m an absolute
beginner . when I try to rake a database like "rake db:schema:dump " I
get this message :
"rake aborted !
unknown database ‘cms_development’ "
although I have modified my database.yml and have created my database
before.
I’ll be appreciated if someone can help me with this
thanks
Can you post database.yml and tell us exactly what command(s) you use
to show that a database of that name does exist.
Colin
On Sat, Jul 16, 2011 at 1:51 PM, smtabatabaie
[email protected] wrote:
yes I can access it with the username and password in database.yml
without any problem
OK, do you have the same rake problem with test and production DBs?
You might also want to tell us what versions of Ruby and Rails you’re
using and which DB server.
–
Hassan S. ------------------------ [email protected]
twitter: @hassan
this is my database.yml content:
MySQL. Versions 4.1 and 5.0 are recommended.
Install the MySQL driver:
gem install mysql2
And be sure to use new-style password hashing:
http://dev.mysql.com/doc/refman/5.0/en/old-client.html
development:
adapter: mysql
encoding: utf8
reconnect: false
database: cms_development
pool: 5
user: smtabatabaie
password: ‘mypassword’
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
encoding: utf8
reconnect: false
database: cms_test
pool: 5
user: smtabatabaie
password: ‘mypassword’
host: localhost
production:
adapter: mysql
encoding: utf8
reconnect: false
database: cms_production
pool: 5
user: smtabatabaie
password: ‘mypassword’
host: localhost
I enter mysql using commands : mysql -u smtabatabaie -p
and then : show databases
and cms_development is there
I haven’t tested ‘test’ and ‘production’ and I have 3.0.9 version of
ruby on rails and working with mysql
On Jul 17, 2:04am, Hassan S. [email protected]
On 17 July 2011 17:48, smtabatabaie [email protected]
wrote:
adapter: mysql
password: ‘mypassword’
host: localhost
I enter mysql using commands : mysql -u smtabatabaie -p
and then : show databases
and cms_development is there
Are you absolutely sure it is spelt right? copy/paste the output of
show databases just to keep us happy. I presume that database.yml
above was copied and pasted here.
Colin
Hi,
Please check if you have all necessary gems too. Copy/paste here the
output pls.
$ gem list
Comments says:
gem install mysql2 -> if mysql2 gem is missing this is the point.
You needn’t use “gem install” because “bundle install” will take care
of all gem dependencies.
One way to detect if your DB connection is the problem:
- first check from console (as you did)
- then test with another type of DB.
Mostly if you’re new in Rails then use just with default settings with
SQLite3. It also requires the gem installed.
If it works with SQLite3 then your DB settings or MySQL username/pw
has problems. If not then then other (probably gem if you haven’t
modified much yet).
Colin’s also right, please check your spelling one more time and copy/
paste here.
If you have struggles with starting contact me in private, good luck,
Gezope
On Sun, Jul 17, 2011 at 9:41 AM, smtabatabaie
[email protected] wrote:
I haven’t tested ‘test’ and ‘production’
So, why not? That would provide a couple more data points.
Problem Determination 101…
–
Hassan S. ------------------------ [email protected]
twitter: @hassan