Flash Sale:75% Off Hosting + Free DomainEnds in13h47m14sView Plans
Hostvento logoHostvento

Create a PostgreSQL Database

This guide shows how to make a new PostgreSQL database in cPanel and from the command line.

Databases2 min read9 steps

What is PostgreSQL?

A database is a place that stores data in an organised way, in tables. A table is like a spreadsheet page. PostgreSQL, often called Postgres, is a kind of database software. Some apps need it instead of MySQL.

A new database starts empty. You then add tables, or an app adds them for you.

Method 1: cPanel

  1. Log in to cPanel.
  2. In the Databases section, click PostgreSQL Databases.
  3. Under Create New Database, type a name.
  4. Click Create Database.
  5. Click Go Back when you see the success message.

cPanel adds your account name before the name, like account_mydb. Write down the full name. You need it later.

Tip: Keep names short, with letters, numbers and underscores. Avoid spaces.

You must also make a user and link it to the database. Otherwise, your app cannot log in. In the same page, use PostgreSQL Users and Add a User To a Database.

If you do not see PostgreSQL Databases, it may not be on your plan. Ask Hostvento support.

Method 2: Command line (root access)

This is for VPS and dedicated server owners who have root access. Root access means full control of the server.

  1. Connect with SSH.
  2. Switch to the postgres user.
su - postgres

This changes you to the user that manages PostgreSQL.

  1. Create the database.
createdb mydb

This makes a database named mydb.

  1. Check that it exists.
psql -l

This lists all databases.

You can also do it inside psql with SQL:

CREATE DATABASE mydb;

Warning: Do not use a name that already exists. Never run DROP DATABASE unless you have a backup. It deletes the database for good.

Quick recap

  • PostgreSQL is a database type, like MySQL.
  • In cPanel use PostgreSQL Databases and Create Database.
  • cPanel adds a prefix to the name. Note the full name.
  • Create a user and link it to the database.
  • On a server with root, use createdb.