Question

I have a website already hosted on heroku.I added all content in the remote refinery.now i hosted the same website on apache using passenger.And i want to copy the content from the heroku refinery to the apache one.How do i go about it? my database.yml file is as follows:

development:
  adapter: mysql2
  encoding: utf8
  database: app_development
  pool: 5
  username: root
  password: root


test:
  adapter: mysql2
  encoding: utf8
  database: app_test
  pool: 5
  username: root
  password: root


production:
  adapter: mysql2
  encoding: utf8
  database: app_production
  pool: 5
  username: root
  password: root

Im using ubuntu 13.10

Was it helpful?

Solution

Is this your new database.yml file? or were you using mysql on heroku too (most people use postgres)? working on the assumption that you were on postgres on heroku and want to move to a mysql local database you will first need to copy your database information onto your new server. For information on how to get the data off've your heroku database see here and here, the relevant line is here:

$ PGPASSWORD=mypassword pg_dump -Fc --no-acl --no-owner -h localhost -U myuser mydb > mydb.dump

Now you'll have a postgres backup file that will be all the sql commands needed to recreate the backup with all your data, you would think that since sql is a standard and mysql uses that too you could just do

mysql my_new_database_name < mydb.dump

Unluckily you're often not that lucky (I would recommend trying it, you never know with simple enough database structures) and you will then need to use a converter, this question recommends using pg2mysql.

This does of course bring up the question of why you want to move to a mysql installation? Here is an article by digital ocean comparing sqlite, mysql and postgres, which has this to say about postgres.

PostgreSQL is the advanced, open-source [object]-relational database management system which has the main goal of being standards-compliant and extensible. PostgreSQL, or Postgres, tries to adopt the ANSI/ISO SQL standards together with the revisions.

For my own opinion I quite like postgresql and find it has less unpleasant surprises than mysql but YMMV. Given the extra work in switching databases I'd probably be inclined to stick to Postgres but that's my opinion.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top