owner_name: Specify the username that you want to use as an owner of the database.db_name: Specify the database name whose owner you want to change.The syntax is following:ĪLTER DATABASE OWNER TO We can use ALTER DATABASE OWNER TO statement to change the owner of the database. Once the database has been renamed, run the following command to verify that the database name has been changed.Īs you can see, the database has been renamed successfully. Postgres=# ALTER DATABASE EltechHR RENAME TO EltechHRDB Suppose we want to rename the EltechHR database to EltechHRDB. new_db_name: Specify the desired new name of the database.Make sure that the database exists on PostgreSQL. old_db_name: Specify the old database name.The syntax is following:ĪLTER DATABASE RENAME TO We can use the ALTER DATABASE RENAME TO statement to rename the database. We can use the ALTER DATABASE statement to perform the following tasksĬhange the default tablespace of the database. Now, let us understand the ALTER DATABASE statement. I have not specified the owner of the database therefore, the owner of the database will be Postgres.Īs you can see, the database has been created successfully. I have not specified any configuration, so the PostgreSQL database will use a template database named template1. Run the following command to create a database. First, launch pSQL and connect to the PostgreSQL database server. We will create a database named EltechHR using the pSQL command. We can use CREATE DATABASE statement to create a new database. Now, let us create a database using the pSQL tool. Postgres=# select datname from pg_database Īlso, run the following command on the pSQL command-line tool. See the following image:Īlternatively, you can run the below query to view the list of databases. Once a database is created, you can view it under the databases section of pgAdmin4. The pgAdmin4 generates the definition to create a PostgreSQL database.Ĭlick on the Save button to create the database. If you want to see the CREATE DATABASE statement, click on the SQL tab. We will learn more about them in my upcoming articles. In the Security tab, parameters tab, and Advanced tab, we can configure the advanced configuration parameters. For the EltechSales database, I have set the following values of the above parameters. In the definition tab, you can specify the encoding, tablespace, database collation, character type, and connection limit. The PostgreSQL user named nisarg will be the database owner, so select nisarg from the user drop-down box. We are creating a database named EltechSales so in the General tab, enter the EltechSales as a database name. The dialog box has different tabs in which you can specify the configuration parameters of the database. To create a database Right-click on Databases, Hover on New and select Database.Ī dialog box named Create-Database opens. Once successfully connected, you can access the objects and databases in the Browser pane of the pgAdmin4. Launch pgAdmin4 □ Specify the master password to connect to the PostgreSQL. When we install the PostgreSQL, the pgAdmin4 installs automatically. Now, let us create a new database using pgAdmin4. If the value of the parameter is set to FALSE, then only the database owner or superuser can clone it. If the value of the parameter is set to TRUE, then any user can clone the database.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |