Closed nelsonic closed 2 years ago
Indeed this was 1 min of googling to refresh memory ...
The ALTER
command is what we're looking for: https://www.postgresql.org/docs/current/sql-alterdatabase.html
In a terminal window on Mac/Linux type: psql
to start the Postgres CLI.
List the databases: \l
(that's a backslash and lowercase "L"):
The command to alter the name of the database is:
ALTER DATABASE db RENAME TO newdb;
In my case it was:
ALTER DATABASE auth_dev RENAME TO auth_dev_archive;
Looks like it worked:
Useful/relevant tutorial:
At present I have a Postgres database on my
localhost
that I don't want toDROP
, but I want to start again from scratch for https://github.com/dwyl/auth/issues/174 ... So I want to rename theauth_dev
database so I can re-use that name. 💭This should be a 1 minute task. But I want to record it somewhere in case I need to do it again.