【发布时间】:2011-06-13 00:16:55
【问题描述】:
我的 PostgreSQL 安装在 Windows 上。如何将数据从 MySQL 数据库迁移到 PostgreSQL? 我读过很多文章。没有任何帮助:(
谢谢。
我的行动:
-
mysql 转储:
mysqldump -h 192.168.0.222 --port 3307 -u root -p --compatible=postgresql synchronizer > c:\dump.sql 在 pgsql 上创建数据库同步器
-
导入转储:
psql -h 192.168.0.100 -d synchronizer -U postgres -f C:\dump.sql -
输出:
psql:C:/dump.sql:17: NOTICE: table "Db_audit" does not exist, skipping DROP TABLE psql:C:/dump.sql:30: ERROR: syntax error at or near "(" СТРОКА 2: "id" int(11) NOT NULL, ^ psql:C:/dump.sql:37: ERROR: syntax error at or near ""Db_audit"" СТРОКА 1:LOCK TABLES "Db_audit" WRITE; ^ psql:C:/dump.sql:39: ERROR: relation "Db_audit" does not exist СТРОКА 1:INSERT INTO "Db_audit" VALUES (4068,4036,4,1,32,'2010-02-04 ... ^ psql:C:/dump.sql:40: ERROR: relation "Db_audit" does not exist СТРОКА 1:INSERT INTO "Db_audit" VALUES (19730,2673,2,2,44,'2010-11-23... ^ psql:C:/dump.sql:42: ERROR: syntax error at or near "UNLOCK" СТРОКА 1:UNLOCK TABLES; ^ psql:C:/dump.sql:48: NOTICE: table "ZHNVLS" does not exist, skipping DROP TABLE psql:C:/dump.sql:68: ERROR: syntax error at or near "(" СТРОКА 2: "id" int(10) unsigned NOT NULL, ^ psql:C:/dump.sql:75: ERROR: syntax error at or near ""ZHNVLS"" СТРОКА 1:LOCK TABLES "ZHNVLS" WRITE; ^ psql:C:/dump.sql:77: WARNING: nonstandard use of escape in a string literal СТРОКА 1:...???????? ??? ???????','10','4607064820115','0','','??????-??... ^ ПОДСКАЗКА: Use the escape string syntax for escapes, e.g., E'\r\n'. Cancel request sent psql:C:/dump.sql:77: WARNING: nonstandard use of escape in a string literal СТРОКА 1:...??????????? ????????','10','4602784001189','0','','???????? ...
【问题讨论】:
-
您可以将数据从您的 mysql 备份到 csv 或类似的 sql 文件,如果可以,您应该能够创建数据库,然后使用 pgadmin 恢复脚本
标签: mysql postgresql migration dump