Renaming a Postgresql Database

How to rename a postgresql database

Gain access via Linux command line. I use Putty.

Get int psql by issuing the command without naming a database like this:

psql

Then issue the following command and press enter:

ALTER DATABASE orig_name RENAME TO new_name;

change orig_name to your original database name and new_name to the new database name you want to rename it to.

Check that it was successful by typing this at psql prompt:

l

and it will give you something like the following output:

Screenshot
Screenshot after renaming maximize_master to maximize_master1

 

Leave a Reply

Your email address will not be published. Required fields are marked *