Last active
June 12, 2025 22:57
-
-
Save limcheekin/d7a7a59104a0e5058cfb09a475a32b44 to your computer and use it in GitHub Desktop.
Create New User and New Database for the PostgreSQL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CREATE ROLE new_user WITH LOGIN PASSWORD 'your_secure_password'; | |
| CREATE DATABASE new_database OWNER new_user; | |
| GRANT ALL PRIVILEGES ON DATABASE new_database TO new_user; | |
| -- Example: | |
| -- CREATE ROLE talking_book WITH LOGIN PASSWORD 'your_secure_password'; | |
| -- CREATE DATABASE think_and_grow_rich OWNER talking_book; | |
| -- GRANT ALL PRIVILEGES ON DATABASE think_and_grow_rich TO talking_book; | |
| -- #psql -U talking_book -d think_and_grow_rich | |
| -- To forcefully drop it—even with active connections | |
| DROP DATABASE new_database WITH (FORCE); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment