how to use a schema name in mysql2psql
Below is a summary of my experiences with migrating from MySQL to Postgres using mysql2psql – https://github.com/maxlapshin/mysql2postgres
%gem install mysql2psql |
To migrate a “tsa” database from mysql to postgres, create a tsa.yml
mysql: hostname: localhost port: 3306 socket: /tmp/mysql.sock username: dbadmin password: password database: tsa destination: # if file is given, output goes to file, else postgres #file: tsa.dump postgres: hostname: localhost port: 5432 database: tsa:hotels #database_name:schema_name username: dbadmin password: password # if tables is given, only the listed tables will be converted. leave empty to convert all tables. #tables: #- table1 #- table2 # if exclude_tables is given, exclude the listed tables from the conversion. #exclude_tables: #- table3 #- table4 # if supress_data is true, only the schema definition will be exported/migrated, and not the data supress_data: false # if supress_ddl is true, only the data will be exported/imported, and not the schema supress_ddl: false # if force_truncate is true, forces a table truncate before table loading force_truncate: false |
Run.
%mysql2psql tsa.yml
|
References:
http://en.wikibooks.org/wiki/Converting_MySQL_to_PostgreSQL