> For the complete documentation index, see [llms.txt](https://docs.arkannis.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.arkannis.net/database/postgresql/create-postgresql-role-and-database.md).

# Create PostgreSQL Role and Database

### Creating PostgreSQL Role and Database

The <mark style="color:orange;">`createuser`</mark> command allows you to create new roles from the command line. Only superusers and roles with <mark style="color:orange;">`CREATEROLE`</mark> privilege can create new roles.

In the following example, we’ll create a new role named <mark style="color:orange;">`kylo`</mark>, a database named <mark style="color:orange;">`kylodb`</mark> and grant privileges on the database to the role.

1. Connect to the database:

```bash
sudo su - postgres
psql
```

1. Create the USER by issuing the following command:

```sql
CREATE USER Kylo with password 'PASSWORD123';
```

1. Create Database:

```sql
CREATE DATABASE kylodb; 
```

1. Grant Permissions to the database

```sql
GRANT ALL PRIVILEGES ON DATABASE kylodb TO kylo;
```
