How to Create a PostgreSQL Database
When you already have PostgreSQL installed, you can easily create a new database by following these steps:
- Open the console by typing
psql postgres
. - Run the
CREATE DATABASE
command, making sure to include a unique name for your database. For example:
1 | CREATE DATABASE databasename; |
Remember to include a semicolon (;) at the end of the command.
- To confirm that your database has been successfully created, execute the
\l
command in the console. You should be able to see the newly created database listed.
Tags: PostgreSQL, database management