Can't open rails console: production database not configured, establish_connection raises ActiveRecord::AdapterNotSpecified Can't open rails console: production database not configured, establish_connection raises ActiveRecord::AdapterNotSpecified mysql mysql

Can't open rails console: production database not configured, establish_connection raises ActiveRecord::AdapterNotSpecified


When you are using the console you specify the environment as the first argument rather than as an environment variable. So:

ruby script/console production

will load the production environment.

Your error message is because it is looking for the environment RAILS_ENV=production rather than just production.


The latest Rails 3 way of doing this is simply:

bundle exec rails console -e production


@Shadwell is correct, however if you're after a consistent syntax you can set RAILS_ENV at the beginning like this:

RAILS_ENV=production rails console