How to create a PostgreSQL database and user
Some applications (Django, Rails, Odoo, many Node.js apps) prefer PostgreSQL. It works like MySQL in the panel: create a database, create a user, and add the user to the database.
Steps
- Log in to the control panel (
https://<server>:2083). - Open PostgreSQL Databases in the menu (section Databases).
- Under Create database, enter a name, for example
app, and click Create. It is calledusername_app. - Under Create database user, enter a name and a password (or click Generate), then click Create. Copy the password now.
- Under Add user to database, choose the User and the Database and click Grant all privileges.
Connection details
| Setting | Value |
|---|---|
| Host | localhost (or 127.0.0.1) |
| Port | 5432 |
| Database | username_app |
| User | username_app |
| Password | the user's password |
Example connection string:
postgresql://username_app:your-password@localhost:5432/username_app
From the command line (Terminal or SSH):
psql -h localhost -U username_app username_app
Good to know
- Every user added to a database has full rights on everything in it, whoever created the tables. Several users can share one database without permission problems.
- Users cannot create databases or other users; do that on this page.
- Each user can have up to 20 connections at the same time.
- Names: lowercase letters, digits and
_, up to 32 characters after the prefix. - MySQL and PostgreSQL databases count together toward your plan's database limit.
- PostgreSQL databases are reachable only from this server, not from other computers.
- To remove access, click the × next to the user under Privileged users. Delete next to a database removes it with all its data.
Common questions
How do I browse tables or run a query?
Click Open next to the database for the built-in tool. See PostgreSQL database tool.
My app says "too many connections for role". Why?
The user has 20 connections open at once. Lower your app's connection pool size, or use a second user for another app.
Thank you — this helps us improve the article.
Still stuck?
Ask the AI about your exact situation — it answers from this knowledge base — or contact us.
Related articles
- How to browse, query and export a PostgreSQL database
Use the built-in PostgreSQL tool to browse tables, run SQL queries (15-second limit, 500 rows) and export the database as a .sql file to your home folder.
- How to change a MySQL or PostgreSQL database user password
Set a new password for a database user in MySQL Databases or PostgreSQL Databases, then update wp-config.php or your app's settings so the site keeps working.
- MySQL connection details: host, port, socket and examples
The database host (localhost), port 3306, socket path, name and user format to connect WordPress, PHP, Laravel, Node.js or Python to MySQL, with examples.