# pqsql terminal ### install for mac M1 ``` arch -x86_64 brew install postgresql ``` ### connect remote db for psql ``` template: psql -h host -p port -d database -U user -W example: psql -h 10.1.30.171 -p 5432 -d exg -U exg -W ``` then type db password ### dump specfic table * contain create table,index, dump to "current" folder, if execuete at /Desktop , then file.sql exist in /Desktop/file.sql ps. if dump then cant find file, you could try "touch xxx.sql" then execute following command dump to xxx.sql ``` template : pg_dump -d <database_name> -t <table_name> > file.sql example: pg_dump -h 10.1.30.171 -p 5432 -U exg -d exg -t provider_transaction_fees > file.sql ``` ### dump specific table only for insertion data [ref](https://www.prisma.io/dataguide/postgresql/inserting-and-modifying-data/importing-and-exporting-data-in-postgresql#controlling-the-output) only get the data insert sql, same as dump table, specify by "--column-inserts --data-only" ``` template: pg_dump --column-inserts --data-only -h <host> -p <port> -U <username> -d <database_name> -t <table_name> > file.sql example: pg_dump --column-inserts --data-only -h 10.1.30.171 -p 5432 -U exg -d exg -t provider_transaction_fees > my_dump.sql ```
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up