Skip to content

Instantly share code, notes, and snippets.

@mazfreelance
Last active September 19, 2023 04:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mazfreelance/9afe62cfb4c69d880ed5bf27cb1260ef to your computer and use it in GitHub Desktop.
Save mazfreelance/9afe62cfb4c69d880ed5bf27cb1260ef to your computer and use it in GitHub Desktop.
setup PostgresSQL database
# Access PostgreSQL: Once PostgreSQL is installed, you can access it using the command-line tool psql.
# Open your terminal or command prompt and run:
psql -U postgres
# Create a Database: To create a new database, you can use the following SQL command inside the psql prompt:
CREATE DATABASE yourdbname;
# Create a User with a Password: You can create a new user and set a password for that user using the following SQL commands:
CREATE USER yourusername WITH PASSWORD 'yourpassword';
# Grant Privileges: To allow the new user to access and manage the database you created,
# you can grant them privileges using the following SQL command:
GRANT ALL PRIVILEGES ON DATABASE "yourdbname" TO "yourusername";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment