当我运行psql时,默认使用的用户是我的用户名:
$ psql
psql (9.4.5)
Type "help" for help.
jeffrey.wan=#
如何将其更改为其他内容?
psql -U jeffrey.wan desired_user
psql (9.4.5)
Type "help" for help.
desired_user=#
答案 0 :(得分:1)
Type \?
to get the list of the available commands, and you will see that the one you are looking for is:
\c desired_user
By the way, the displayed name is the database you are connected to, not the user you are connected as. You can specify another user by typing it as second parameter.
But you'd better look up for the command line parameters when you connect the first time. For example, this will bring you where you want directly:
psql -d database -U user -h hostname