PostgresSQL database import database backup from command

有時候個SQL script 太大.. 如果用 SQL editor 去 run 個 .sql file 好大機會 會crash
我地可以用 command 來 execute 呢個 .sql

我就用呢個方法去Restore database backup

解決方法:

psql -h [`hostname`] -U [`username`] -d [`database_name`] -f [`sql_script.sql`]

psql -h localhost -U postgres -d local-db -f dump-local-db-20220701150001.sql

hope you find it useful

Chi Yau
Chi Yau
Software Engineer

Interested on Learning new stuff and experience sharing