TheRealChx101
TheRealChx101

Reputation: 1544

How to clear PostgreSQL psql command history

When login to the database using psql -u postgres, all the commands entered there can be seen in and recalled from history.

I created a role with a password and I would like to clear that entry.

How can I clear the history?

Upvotes: 5

Views: 12936

Answers (2)

yihanwu1024
yihanwu1024

Reputation: 71

If you used sudo -u postgres, the file should be in the home of your postgres user. In my case it is /var/lib/postgresql/.psql_history.

Edit: I misread your original command and thought sudo was used.

Upvotes: 7

Fauzi Fadillah
Fauzi Fadillah

Reputation: 189

Please check on the /home/user/.psql_history, then open the file if we want we can clear all the commands or the necessary commands and save the file.

Upvotes: 14

Related Questions