将记录从 PostgreSQL 导入 MySQL
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5737063/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Importing records from PostgreSQL to MySQL
提问by Joseph
Was wondering if anyone had any insight or recommended tools for exporting the records from a PostgreSQL database and importing them into a MySQL database. I believe the table structure is 100% identical.
想知道是否有人对从 PostgreSQL 数据库导出记录并将它们导入 MySQL 数据库有任何见解或推荐的工具。我相信表结构是 100% 相同的。
Thoughts? Thanks!
想法?谢谢!
回答by Matthew Wood
The command
命令
pg_dump --data-only --column-inserts <database_name>
will generate SQL-standard-compliant INSERT statements with all column names listed and one VALUES clause per INSERT. This is the most portable way of moving data from PostgreSQL to any other SQL database.
将生成符合 SQL 标准的 INSERT 语句,其中列出了所有列名和每个 INSERT 一个 VALUES 子句。这是将数据从 PostgreSQL 移动到任何其他 SQL 数据库的最便携方式。
回答by fvu
Check out SquirrelSQL, it can pump data from one database brand into another via the DBCopy plugin. When the table structures are really identical it works quite well.
看看SquirrelSQL,它可以通过DBCopy 插件将数据从一个数据库品牌泵送到另一个数据库品牌。当表结构真的相同时,它工作得很好。
回答by eggie5
There is a ruby app called Taps that will do it. I've used it before with great success:
有一个名为 Taps 的 ruby 应用程序可以做到这一点。我以前使用过它并取得了巨大成功:
http://adam.heroku.com/past/2009/2/11/taps_for_easy_database_transfers/
http://adam.heroku.com/past/2009/2/11/taps_for_easy_database_transfers/