mysqldump -h<host> --compatible=postgresql -u<user> -p <database_name> > /tmp/my_dump.sql
cat my_dump.sql | mysql -h<host> -u<user> -p <database_name>
Use the mysql2psql gem as recommended by Heroku:
$ gem install mysql2psql
...
$ mysql2psql
No configuration file found.
A new file has been initialized at: /Users/you/dev/app/mysql2psql.yml
Please review the configuration and retry..
Edit the generated config:
mysql:
hostname: localhost
port: 3306
socket: /tmp/mysql.sock
username: <username>
password: <password>
database: <db_name>
destination:
# if file is given, output goes to file, else postgres
file:
postgres:
hostname: localhost
port: 5432
username: <username>
password: <password>
database: <db_name>
Run the transfer using the specified config:
$ mysql2psql
Following Heroku's instructions here:
PGPASSWORD=<password> pg_dump -Fc --no-acl --no-owner -h <host> -U <user> <db_name> > my_dump.dump
e.g. S3
Using the pgbackups add-on:
heroku pgbackups:restore DATABASE 'https://s3.amazonaws.com/foo/bar/my_dump.dump'
The value of DATABASE should be the Heroku database env variable. You can find this with:
$ heroku config | grep HEROKU_POSTGRESQL
hey @tjmw how do you manage a postgres database in mac?