Skip to content

Commit 328d0b8

Browse files
authored
(Examples - Databases - PostgreSQL) Add more info about configuring the database (#2156)
## Summary I was struggling to configure postgresql with Phoenix Framework because of the lack of instructions, so I figured it out and am adding the information that solved my problem. ## How was it tested? I've tested on terminal and using the Phoenix Framework to create the database. Signed-off-by: Rafael <[email protected]>
1 parent 5fe9e30 commit 328d0b8

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

docs/app/docs/devbox_examples/databases/postgres.md

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,29 @@ You can use `devbox services start|stop postgresql` to start or stop the Postgre
4141

4242
This variable tells PostgreSQL which directory to use for creating and storing databases.
4343

44-
### Notes
44+
### NOTES
4545

46-
To initialize PostgreSQL run `initdb`. You also need to create a database using `createdb <db-name>`
46+
1. To initialize PostgreSQL run:
47+
```sh
48+
initdb
49+
```
50+
3. You also need to create a user using:
51+
```sh
52+
createuser --interactive
53+
```
54+
5. (OPTIONAL) If the user has no permissions to create or drop a database, you also need to create a database using:
55+
```sh
56+
createdb <db-name>
57+
```
58+
59+
#### Using the `createuser` Command
60+
61+
Run the createuser command with the `-s` or `--superuser` option to create a superuser. This grants the user the ability to bypass all access permission checks within the database, effectively granting them extensive privileges including the ability to create and drop databases. Additionally, you can use the `-r` or `--createrole` option to allow the user to create new roles. Here's an example command:
62+
63+
```sh
64+
createuser -s -r your_new_user_name
65+
```
66+
67+
Replace `your_new_user_name` with the desired username for the new superuser.
4768

69+
Remember: Creating a superuser grants them significant power over the database system, so it should be done cautiously and only when absolutely necessary due to the potential security implications.

0 commit comments

Comments
 (0)