centos7 执行一个数据库脚本创建项目中的数据库

[root@localhost ~]# su postgres 切换用户 
bash-4.2$ psql
could not change directory to "/root": Permission denied
psql (9.5.6)
Type "help" for help.

postgres=# psql -Upostgres
postgres-# psql -Upostgres</root/Desktop/db.sql 我的脚本在桌面

==================
[root@localhost dreamstart]# su postgres

bash-4.2$ psql -Upostgres<db.sql
 
 参看http://www.cnblogs.com/Amos-Turing/p/6862253.html
原文地址:https://www.cnblogs.com/Amos-Turing/p/7235543.html