简体   繁体   English

由于“`”,MySQL 到 Postgresql 备份无效命令?

[英]MySQL to Postgresql backup invalid command due to "`"?

I have an old backup sql file with ` in it.我有一个带有`的旧备份 sql 文件。 When I try to load it via psql dbname < db_backup.sql I get an error:当我尝试通过psql dbname < db_backup.sql加载它时,出现错误:

 ERROR: syntax error at or near "`" DROP TABLE IF EXISTS `tablename`;

Is there a way to tell psql to treat ` like ' ?有没有办法告诉 psql 对待` like '

You should create the dump using mysqldump --compatible=ansi to avoid this and other migration incompatibilities.您应该使用mysqldump --compatible=ansi创建转储以避免这种和其他迁移不兼容性。 I suggest you make a separate MySQL database using your existing backup as it is, then do a dump with this option to make the compatible one.我建议您使用现有备份创建一个单独的 MySQL 数据库,然后使用此选项进行转储以使其兼容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM