Ubuntu中的PostgreSQL pg_dump语法错误 [英] PostgreSQL pg_dump syntax error in Ubuntu

查看:584
本文介绍了Ubuntu中的PostgreSQL pg_dump语法错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在ubuntu 16.04中,当我想运行pg_dump时不起作用,我收到此错误语法错误。

In ubuntu 16.04 when i want to run pg_dump it doesn't work i got this error syntax error. What is wrong ?

postgres=# pg_dump db_name > db_name1.sql
postgres-#
postgres-# ;
ERROR:  syntax error at or near "pg_dump"
LINE 1: pg_dump db_name > db_name1.sql
        ^
postgres=#


推荐答案

pg_dump 不是SQL命令。

这是一个独立的实用程序,因此您无法从SQL查询中运行它。
单击链接以获取更多信息。

It is a stand-alone utility, so you cannot run it from SQL query. Follow the link for more information.

对于您的情况:键入 \q< Enter> 从SQL客户端退出并再次重复您的命令使用shell提示。
请记住,您应该使用SQL凭证。
即:

For your case: type \q<Enter> to quit from SQL-client and repeat your command again using shell prompt. Remember you should use your SQL-credentials. I.e.:

$ pg_dump -U <postgres_user_name> db_name > db_name1.sql`

这篇关于Ubuntu中的PostgreSQL pg_dump语法错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆