How to rename a PostgreSQL database
Renaming a PostgreSQL database
Renaming a PostgreSQL database can be necessary occasionally, for example, when transferring data between accounts or hosting providers or developing a website.
The steps to rename a PostgreSQL database depend on whether or not your Hostvento Hosting account includes cPanel access.
Managed accounts with cPanel
If your Hostvento Hosting account includes cPanel access, you can use cPanel to quickly and easily rename a PostgreSQL database. To do this, follow these steps:
- Log in to cPanel.If you do not know how to log in to your cPanel account, please see this article.
- In the DATABASES section of the cPanel home screen, click PostgreSQL Databases:
- Under Current Databases, locate the database you want to rename.
- 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:
- Click Proceed. cPanel renames the database.
Unmanaged accounts without cPanel
If your Hostvento 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:
- Log in to your server using SSH.
- At the command prompt, type the following command to connect to PostgreSQL. Replace dbname with the name of a database that is not the database you want to rename, and replace username with a PostgreSQL username that has access privileges to the database:Copypsql dbname usernameYou cannot rename a database while you are currently connected to it.
- 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:
CopyALTER DATABASE “old_dbname” RENAME TO “new_dbname“ - To verify that the database was renamed, type the following command to list the databases:
Copy\list
How to measure website performance using Google Chrome Developer Tools