Last active
July 7, 2021 05:51
-
-
Save majidux/171241dead7c9ee1f33894b156d35187 to your computer and use it in GitHub Desktop.
Here lies docker commands for postgresql
This file contains 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
docker pull postgres | |
// run postgres container | |
docker run --name mypg -e POSTGRES_PASSWORD=mysecretpassword -d -p 5432:5432 postgres | |
// root access to potgres | |
psql -U postgres | |
// see roles | |
\du | |
// see databases | |
\l | |
// create new database in docker | |
create database DBNAME; | |
// connect to db | |
\c DBNAME | |
// connect to postgres container from local machine | |
psql -h localhost -p 5432 -U postgres |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment