postgresql - Serbipunk/notes GitHub Wiki

install

https://youtu.be/tducLYZzElo?si=Q_AowljWtosvJUjd

install script

(base) mb@mb:~/tool/postgre$ cat install_pgadmin.sh 
#
# Setup the repository
#

# Install the public key for the repository (if not done previously):
curl -fsS https://www.pgadmin.org/static/packages_pgadmin_org.pub | sudo gpg --dearmor -o /usr/share/keyrings/packages-pgadmin-org.gpg

# Create the repository configuration file:
sudo sh -c 'echo "deb [signed-by=/usr/share/keyrings/packages-pgadmin-org.gpg] https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/$(lsb_release -cs) pgadmin4 main" > /etc/apt/sources.list.d/pgadmin4.list && apt update'

#
# Install pgAdmin
#

# Install for both desktop and web modes:
sudo apt install pgadmin4

# Install for desktop mode only:
sudo apt install pgadmin4-desktop

# Install for web mode only: 
sudo apt install pgadmin4-web 

# Configure the webserver, if you installed pgadmin4-web:
sudo /usr/pgadmin4/bin/setup-web.sh

pgadmin

http://127.0.0.1/pgadmin4

psql examples

switch user

sudo -i -u postgres

createdb

createdb my_pgdb
psql -d my_pgdb

create user

https://phoenixnap.com/kb/postgres-create-user

sudo -u postgres createuser --superuser superusermiles -P
\password