Skip to main content
0 reactions

How to Create a Database in pgAdmin 4

Card for How to Create a Database in pgAdmin 4: one dialog and no SQL to type, with the steps Databases, Create, Database…, Name: recipes and Save.
How to Create a Database in pgAdmin 4.

pgAdmin 4 can create a PostgreSQL database for you, with no SQL to type: one dialog, then Save. Here’s how to create a database in pgAdmin 4, using a small example database called recipes.

Every screen on this page is real, from pgAdmin 4 9.19 with PostgreSQL 19 on macOS.

Step 1: Open the Create Database Dialog

In the Object Explorer, open your server, here PostgreSQL 19. Right-click Databases and choose Create › Database…:

The Object Explorer in pgAdmin 4 with Databases right-clicked, Create opened and Database… highlighted in its submenu.
Right-click Databases, then choose Create and Database…

Step 2: Name the Database

On the General tab, type a name in Database. This guide uses recipes. Lowercase letters, digits and underscores are the safe choice for a name.

Owner is the user who will own the new database. It starts as the user pgAdmin is connected as, postgres here. Leave it, and leave the other fields empty:

The Create - Database dialog on its General tab, with recipes typed in the Database field and postgres chosen as the Owner.
General tab: type the name of the new database.

Step 3: Check the SQL

Click the SQL tab to see the statement pgAdmin will run:

The SQL tab of the Create - Database dialog, showing CREATE DATABASE recipes WITH OWNER = postgres, ENCODING = UTF8, LOCALE_PROVIDER = libc, CONNECTION LIMIT = -1 and IS_TEMPLATE = False.
The SQL tab shows the statement pgAdmin will run.

It’s a CREATE DATABASE statement with pgAdmin’s defaults spelled out: the owner, the UTF8 encoding, the locale provider, no connection limit, and not a template. You could run the same statement yourself in psql or in pgAdmin’s Query Tool.

Step 4: Save

Click Save. pgAdmin creates the database, connects to it and opens it in the Object Explorer:

The Object Explorer showing Databases (2) with the new recipes database opened below postgres, its Casts and Catalogs folders showing.
Saved: recipes appears under Databases.

Clean Up

To delete the example database, right-click recipes and choose Drop:

The right-click menu of the recipes database in pgAdmin 4, with Drop highlighted above Drop (Force), Refresh, Restore and Backup.
Right-click the database and choose Drop.

pgAdmin asks first. Click Drop:

The Drop Database? box asking Are you sure you want to drop the database recipes? with Cancel and a red Drop button.
Click Drop to confirm.

Warning: Dropping a database deletes it and everything in it, and it can’t be undone.

recipes is gone from the list:

The Object Explorer showing Databases (1), with only postgres left under PostgreSQL 19.
The recipes database is gone.

Common Mistakes

MistakeWhat happensDo this instead
Leaving Database emptySave stays greyed out, and pgAdmin shows 'Database' cannot be empty.Type a name on the General tab.

FAQ

Can I choose the encoding or the template?

Yes, on the Definition tab. Encoding is UTF8 by default, and with Template left empty the new database is a copy of template1, as the pgAdmin documentation (opens in a new tab) describes. template0 vs template1 in PostgreSQL explains the two templates.

Is this the same as CREATE DATABASE?

Yes. pgAdmin runs the CREATE DATABASE statement its SQL tab shows. Part 4 of the PostgreSQL Tutorial creates a database with that statement in psql.

Conclusion

Right-click Databases, choose Create › Database…, type a name and click Save. The SQL tab shows the exact statement pgAdmin runs, which is a handy way to learn the SQL behind each dialog.

Additional Resources

Postgres, PostgreSQL and the Slonik Logo are trademarks or registered trademarks of the PostgreSQL Community Association of Canada, and used with their permission.

0 comments