在我的psql提示符中可以看到密码(通过按向上箭头查看以前输入的命令).所以我想从psql客户端删除这个条目.

其他资源(12)声称psql客户机历史记录保存在一个~/.psql_history文件中,但是这个文件根本不存在.(也不是在.bash_history中)

那么there must be another file where the history of psql prompt is kept, any ideas where?

我像这样登录到提示符

注:我正在研究Ubuntu 12.04

推荐答案

使用时:

sudo -u postgres psql my_db

您以(Linux)用户postgres的身份运行psql,因此.psql_history文件位于postgres用户(例如/home/postgres/.psql_history)的主目录中,而不是您最初登录的用户的主目录中.

在某些安装中,postgres用户的主目录的位置是/var/lib/postgresql.您可以通过运行以下命令来判断这一点:

grep postgres /etc/passwd | cut -d ':' -f 6

Postgresql相关问答推荐

为什么在PostgreSQL中CPU_INDEX_TUPLE_COST与CPU_TUPLE_COST不同

将XML解析从T-SQL迁移到Postgres时出现问题

docker-compose.yml用于使用postgres的spring-boot应用程序

在 Postgres 中,部分索引比普通索引需要更多的时间和成本来执行

为什么我使用 VBA 只能从 postgres 获得 10 行?

查找列中的数据是否满足sql中的数据类型条件

如何在 PostgreSQL 中使用正则表达式删除单词之间的所有特殊字符和多余空格

如何在 postgresql 中创建一个空的 JSON 对象?

是否可以在 PostgreSQL 中部分刷新materialized视图?

PostgreSQL:如何安装 plpythonu 扩展

使用 current_setting() 判断值

使用 pg_dump 和 psql -U postgres db_name < ... 移动数据库会导致ERROR: relation "table_name" does not exist

manage.py 迁移时必须是关系 django_site 的所有者

Rails:PG :: InsufficientPrivilege:错误:permission denied for relation schema_migrations

如何在带有 PostgreSQL 数据库的 Web 应用程序中拥有完整的离线功能?

如何正确索引多对多关联表?

在 Postgresql 中按窗口函数结果过滤

PGError:错误: column of relation does not exist

Rails PG::UndefinedTable:错误:missing FROM-clause entry for table

Capistrano 与 PostgreSQL,错误:database is being accessed by other users