从shell脚本运行psql查询
我有一个PSQL语句,它需要从shell脚本运行。 我在下面试过,但没有成功从shell脚本运行psql查询,shell,psql,Shell,Psql,我有一个PSQL语句,它需要从shell脚本运行。 我在下面试过,但没有成功 ctfdb是我的数据库 psql ctfdb <<EOF statement EOF psql-U postgres-ctfdbpsql-U postgres-ctfdb 以用户身份连接postgres。您正在以shell用户名root连接到数据库 还有其他方法,例如设置PGUSER环境变量或配置pg_hba.conf以允许其他用户访问。psql-U postgres ctfdb 以用户身份连接postg
ctfdb
是我的数据库
psql ctfdb <<EOF
statement
EOF
psql-U postgres-ctfdbpsql-U postgres-ctfdb
以用户身份连接postgres
。您正在以shell用户名root
连接到数据库
还有其他方法,例如设置PGUSER
环境变量或配置pg_hba.conf
以允许其他用户访问。psql-U postgres ctfdb
以用户身份连接postgres
。您正在以shell用户名root
连接到数据库
还有其他方法,例如设置PGUSER
环境变量或配置pg_hba.conf
以允许其他用户访问