将 PostgreSQL 转储文件转换为 MySQL?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8746920/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-20 23:31:40  来源:igfitidea点击:

Convert PostgreSQL dump file to MySQL?

mysqlsqlpostgresql

提问by Norm

I want to convert a PostgreSQL dump file I received to a MYSQL dump file or even sql text to be generated?

我想将收到的 PostgreSQL 转储文件转换为 MYSQL 转储文件,甚至是要生成的 sql 文本?

回答by araqnid

If you install the PostgreSQL client programs, you can use "pg_restore" to convert a dump file to a SQL script without having to have a PostgreSQL instance. Just do pg_restore dumpfile.pgand it will print the restore SQL to stdout.

如果您安装 PostgreSQL 客户端程序,您可以使用“pg_restore”将转储文件转换为 SQL 脚本,而无需拥有 PostgreSQL 实例。只要这样做pg_restore dumpfile.pg,它就会将恢复 SQL 打印到标准输出。

回答by Mwirabua Tim

If you have PostgreSQL installed on your terminal and your file is latest.dumpyou just need to convert it to latest.sqlthis way:

如果您的终端上安装了 PostgreSQL 并且您的文件是这样latest.dump,则只需将其转换为latest.sql这种方式:

$ pg_restore latest.dump > latest.sql

$ pg_restore latest.dump > latest.sql

回答by Pete Wilson

A google searchyielded a reference to this discussion. It looks hopeful and maybe it will help.

一个谷歌搜索产生的参考讨论。看起来很有希望,也许会有所帮助。

HTH

HTH