Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

postgres run query from command line

## Using SQL file
PGPASSWORD=myPassword psql -h myDbHost -U myUser -p 5432 -d my_db -a -q -f /path/to/sql/file.sql
## Or
PGPASSWORD=myPassword psql -h myDbHost -U myUser -p 5432 -d my_db < /path/to/sql/file.sql

## Using command
PGPASSWORD=myPassword psql -h myDbHost -U myUser -p 5432 -d my_db -c "select * from my table limit 1;"
Comment

how to run sql script in postgresql

export PGPASSWORD=<password>
psql 
  -h <host> 
  -d <db> 
  -U <user> 
  -p 5432 
  -a 
  -q 
  -f <path_to_file>
Comment

PREVIOUS NEXT
Code Example
Shell :: grep in windows 
Shell :: creating a github repository from the cli 
Shell :: Permission denied (publickey,keyboard-interactive). 
Shell :: nginx letsencrypt 
Shell :: open current dir cmd 
Shell :: change user password on mac terminal 
Shell :: bash remove trailing whitespace from every line 
Shell :: how to sort tags on git tag 
Shell :: bash inline countdown 
Shell :: docker compose exec compose 
Shell :: ubuntu usb drive format 
Shell :: force remove hidden folder in linux 
Shell :: uninstall specific java openjdk ubuntu 
Shell :: find logs in kubernetes pods 
Shell :: composer add git repository 
Shell :: install ruby linux 
Shell :: git untracked folder 
Shell :: comments in bash file 
Shell :: git overwrite remote files 
Shell :: heroku remove branch 
Shell :: boot pendrive cmd 
Shell :: how to check requirements.txt was installed correctly 
Shell :: how to upgrade maven in linux 
Shell :: change default terminal linux 
Shell :: sudo rmdir recursive 
Shell :: reset certain file git 
Shell :: how to remove spaces at end of line linux 
Shell :: clone github repository mac terminal 
Shell :: how to install dataloader 
Shell :: [Thu Nov 5 15:20:23 2020] Failed to listen on localhost:3200 (reason: Address already in use) 
ADD CONTENT
Topic
Content
Source link
Name
8+7 =