参考:https://www.cnblogs.com/wyl89/p/8616935.html
https://blog.csdn.net/hehong_78/article/details/6091011
交互式(即进入psql命令行执行sql语句)
psql -U postgres #以postgres用户登录psql
psql界面长下图这样:
非交互式(即直接在linux系统命令行执行pg sql)
执行sql语句:
psql dbname -U username -w -c "sql语句"
例如:
psql test -U postgres -w -c "select * from department"
执行数据库文件:
psql dbname -U username -w -f db.sql
yum下安装配置pg参考:https://blog.csdn.net/feinifi/article/details/96474115
网友评论