How do you copy over a development database to production?

I know to copy your development database schema over to your test
database uses db:test:prepare.

What’s the equivalent command to copy the development database over to
the production database?

Personally, I just export/import the database via sql admin. Much
simpler to manage.

On Aug 21, 3:45 pm, Bob S. [email protected]

I use mongrel_rails cluster and apache, and subversion and
capistrano. One day soon I will look into doing all this with scripts
and / or subversion / capistrano, but for now, this is not too bad:

On my production box:

remove the production database (I keep backups on the development
side, which is where all my changes take place):

mysql > drop database projectname_production

create a new empty production database, so I can import new sql into
it in a moment:

mysql > create database projectname_production

Then, on development my development box:

dump out the entire development database into an sql file:

mysqldump -u mysql -p projectname_development >

copy entire database to production machine

on production machine:
mongrel_rails cluster::stop
apachectl stop

mysql -u root -p projectname_production < projectname_production.sql

mongrel_rails cluster::start
apachectl start

That’s what I do –


Hi Bob,

this may be a silly answer, but just putting it across,

change your database.yml file entries

exchange your username, password, database, host etc, in production to
then run the corresponding rake task. (i don’t remember the task, may
be “rake clone:db_struture” or “rake test:db:prepare”

doing this will copy all your schema but it may not copy the
constraints you defined on those database objects.

Charlie and raghukumar,

Thank you for your fabulous ideas. I really appreciate it. I just got it
set up, and it works great. Thanks a bunch!

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs