SitePoint Sponsor

User Tag List

Results 1 to 10 of 10
  1. #1
    SitePoint Member
    Join Date
    Oct 2007
    Posts
    23
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unknown Database

    I have issue with rake. When I run rake db:migrate, I got ''unknown database ' ' " . When I try the same database on the PHP, it works. I am of the view that I am in deep blue sea .Could you assist?
    Regards

  2. #2
    SitePoint Evangelist
    Join Date
    Feb 2006
    Location
    Worcs. UK
    Posts
    404
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This could be confusion over what a database is. You can get this message if there is no schema present, but there is a database engine instance. It's probably clearer if I set out what is required:

    Say you have a new application call myapp and you want to create database areas on a MySQL database engine for this application. The default would be myapp_development, myapp_production, and myapp_test. Rake won't create these for you. So you must:

    1. Install your database engine (e.g. MySQL) if not already installed.
    2. Create the database spaces (called schema in MySQL). myapp_development, myapp_production, and myapp_test.
    3. And only then start creating tables via migration.


    If you miss out the middle step, you can get the errors you describe.

  3. #3
    SitePoint Member
    Join Date
    Oct 2007
    Posts
    23
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Could you be specific. I have MYSQL running and I have the database in questioned confirmed 'okay' via PHP on Appache box. What actually do you propose?

  4. #4
    SitePoint Wizard samsm's Avatar
    Join Date
    Nov 2001
    Location
    Atlanta, GA, USA
    Posts
    5,011
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What do you have in config/database.yml ?
    Using your unpaid time to add free content to SitePoint Pty Ltd's portfolio?

  5. #5
    SitePoint Member
    Join Date
    Oct 2007
    Posts
    23
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    development:
    adapter: mysql
    database: rails_cool_development
    username: root
    password: my_password
    host: localhost

    test:
    adapter: mysql
    database: rails_cool_test
    username: root
    password: my_password
    host: localhost

    production:
    adapter: mysql
    database: rails_cool_production
    username: root
    password: my_password
    host: localhost

  6. #6
    SitePoint Evangelist
    Join Date
    Feb 2006
    Location
    Worcs. UK
    Posts
    404
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Do rails_cool_development, rails_cool_test, and rails_cool_production exist within your database?

  7. #7
    SitePoint Member
    Join Date
    Oct 2007
    Posts
    23
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, they do. I could play with rails_cool_development and others on PHP running on Apache box.

  8. #8
    SitePoint Evangelist
    Join Date
    Feb 2006
    Location
    Worcs. UK
    Posts
    404
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I assume that MySQL is installed on the same system as the Rails application.

    Do you get the same message if you do:

    Code:
    rake environment RAILS_ENV=production db:migrate
    Can you also confirm that you are using Linux?

  9. #9
    SitePoint Guru silver trophy Luke Redpath's Avatar
    Join Date
    Mar 2003
    Location
    London
    Posts
    794
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Is your YAML file formatted properly (no tabs!).

  10. #10
    SitePoint Member
    Join Date
    Oct 2007
    Posts
    23
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I run on XP home edition. Could it be becuase I have MYSQL version 4.1.0?


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •