This article explains how to rename a PostgreSQL database.
You may need to rename a PostgreSQL database from time to time, such as when you migrate data from one account or hosting provider to another, or during site development.
The steps to rename a PostgreSQL database depend on whether or not your A2 Hosting account includes cPanel access.
If your A2 Hosting account includes cPanel access, you can use cPanel to quickly and easily rename a PostgreSQL database. To do this, follow these steps:
In the Actions column, click Rename:
The Rename Database dialog box appears.
In the New name text box, type the new name for the database:
If your A2 Hosting account does not include cPanel, you can quickly and easily rename a PostgreSQL database from the command line. To do this, follow these steps:
psql dbname username
To rename the database, type the following command. Replace old_dbname with the name of the database that you want to rename, and replace new_dbname with the database's new name:
ALTER DATABASE "old_dbname" RENAME TO "new_dbname"
To verify that the database was renamed, type the following command to list the databases:
Subscribe to receive weekly cutting edge tips, strategies, and news you need to grow your web business.
No charge. Unsubscribe anytime.