问题描述
我怎么登录,都要求输入密码,如图:
查看如下参数
Connection options:
-h, --host=HOSTNAME database server host or socket directory (default: “local socket”)
-p, --port=PORT database server port (default: “5432”)
-U, --username=USERNAME database user name (default: “root”)
-w, --no-password never prompt for password
-W, --password force password prompt (should happen automatically)
发现-W根本不是密码的输入!!!
命令参数解释
没办法,我查看了所有参数如下,竟然没有指定参数来输入密码!!!
[root@localhost ~]# psql --help
psql is the PostgreSQL interactive terminal.Usage:psql [OPTION]... [DBNAME [USERNAME]]General options:-c, --command=COMMAND run only single command (SQL or internal) and exit-d, --dbname=DBNAME database name to connect to (default: "root")-f, --file=FILENAME execute commands from file, then exit-l, --list list available databases, then exit-v, --set=, --variable=NAME=VALUEset psql variable NAME to VALUE(e.g., -v ON_ERROR_STOP=1)-V, --version output version information, then exit-X, --no-psqlrc do not read startup file (~/.psqlrc)-1 ("one"), --single-transactionexecute as a single transaction (if non-interactive)-?, --help[=options] show this help, then exit--help=commands list backslash commands, then exit--help=variables list special variables, then exitInput and output options:-a, --echo-all echo all input from script-b, --echo-errors echo failed commands-e, --echo-queries echo commands sent to server-E, --echo-hidden display queries that internal commands generate-L, --log-file=FILENAME send session log to file-n, --no-readline disable enhanced command line editing (readline)-o, --output=FILENAME send query results to file (or |pipe)-q, --quiet run quietly (no messages, only query output)-s, --single-step single-step mode (confirm each query)-S, --single-line single-line mode (end of line terminates SQL command)Output format options:-A, --no-align unaligned table output mode-F, --field-separator=STRINGfield separator for unaligned output (default: "|")-H, --html HTML table output mode-P, --pset=VAR[=ARG] set printing option VAR to ARG (see \pset command)-R, --record-separator=STRINGrecord separator for unaligned output (default: newline)-t, --tuples-only print rows only-T, --table-attr=TEXT set HTML table tag attributes (e.g., width, border)-x, --expanded turn on expanded table output-z, --field-separator-zeroset field separator for unaligned output to zero byte-0, --record-separator-zeroset record separator for unaligned output to zero byteConnection options:-h, --host=HOSTNAME database server host or socket directory (default: "local socket")-p, --port=PORT database server port (default: "5432")-U, --username=USERNAME database user name (default: "root")-w, --no-password never prompt for password-W, --password force password prompt (should happen automatically)For more information, type "\?" (for internal commands) or "\help" (for SQL
commands) from within psql, or consult the psql section in the PostgreSQL
documentation.Report bugs to <pgsql-bugs@postgresql.org>.
问题解决
好在pgsql提供了解决办法:
PGPASSWORD=1234567899 psql -h 10.12.1.203 -U postgres -p 5432 -d tengine2.0