Can't create db - db_config['database'] is blank?

0 views
Skip to first unread message

Scott

unread,
Aug 2, 2008, 4:08:34 PM8/2/08
to ec2-on-rails-discuss
Hi all;

ec2onrails:setup always fails on the database creation step:

--
* executing "mysql -u root -e \"create database if not exists ;\""
servers: ["ec2-xxxxx.compute-1.amazonaws.com"]
[ec2-xxxxx.compute-1.amazonaws.com] executing command
** [out :: ec2-xxxxx.compute-1.amazonaws.com] ERROR
** [out :: ec2-xxxxx.compute-1.amazonaws.com] 1064 (42000)
** [out :: ec2-xxxxx.compute-1.amazonaws.com] at line 1
** [out :: ec2-xxxxx.compute-1.amazonaws.com] : You have an error in
your SQL syntax; check the manual that corresponds to your MySQL
server version for the right syntax to use near '' at line 1
command finished
command "mysql -u root -e \"create database if not exists ;\"" failed
on ec2-xxxxx.compute-1.amazonaws.com
---

It appears that db_config['database'] is empty, even though
db:load_config checks for that condition. I have a proper database.yml
both locally and on my EC2 instance in /mnt/app/config/, so I don't
quite understand why it's failing.

Any ideas? Many thanks.

Paul Dowman

unread,
Aug 10, 2008, 2:16:45 PM8/10/08
to ec2-on-rai...@googlegroups.com
Hi Scott,

Perhaps it's confused about what the value of RAILS_ENV should be. When you run the ec2onrails:setup task, it uses the value of :rails_env from the deploy.rb file as the RAILS_ENV that mongrel (and other rails-related processes) should use.

Log into the instance by ssh and type "rails_env" to see what the value is, and make sure your database.yml has a section with that name.

Paul

Joshua Kolden

unread,
Aug 20, 2008, 1:39:39 PM8/20/08
to ec2-on-rails-discuss
I'm having this problem too. If I ssh to the instance and echo
$RAILS_ENV I see nothing, but I'm not confident that indicates
anything. Anyone have a solution yet?

Thanks,
j

On Aug 2, 1:08 pm, Scott <scottburto...@gmail.com> wrote:
> Hi all;
>
> ec2onrails:setup always fails on the database creation step:
>
> --
>   * executing "mysql -u root -e \"create database if not exists ;\""
>     servers: ["ec2-xxxxx.compute-1.amazonaws.com"]
>     [ec2-xxxxx.compute-1.amazonaws.com] executing command
>  ** [out :: ec2-xxxxx.compute-1.amazonaws.com]ERROR
>  ** [out :: ec2-xxxxx.compute-1.amazonaws.com] 1064 (42000)
>  ** [out :: ec2-xxxxx.compute-1.amazonaws.com] at line 1
>  ** [out :: ec2-xxxxx.compute-1.amazonaws.com] :YouhaveanerrorinyourSQLsyntax; check the manual that corresponds toyourMySQL
> server version for the rightsyntaxto use near '' at line 1
>     command finished
> command "mysql -u root -e \"create database if not exists ;\"" failed
> on ec2-xxxxx.compute-1.amazonaws.com
> ---
>
> It appears that db_config['database'] is empty, even though
> db:load_config checks for that condition. Ihavea proper database.yml

Joshua Kolden

unread,
Aug 20, 2008, 1:59:15 PM8/20/08
to ec2-on-rails-discuss
Actually if I run RAILS_ENV as described above, I do get "production".

j
Reply all
Reply to author
Forward
0 new messages