Closed swearl closed 2 years ago
原因是 TMP_DIR="$(mktemp -d)" 这里创建的临时目录的权限是700, 然后把sql放进去后
cat > ${TMP_DIR}/sql.sql <<-EOF CREATE USER zhenxun WITH PASSWORD 'zxpassword'; CREATE DATABASE zhenxun OWNER zhenxun; EOF
再
su postgres -c "psql -f ${TMP_DIR}/sql.sql"
因为postgres不能读取root创建的700临时目录, 就出现了 psql: error: /tmp/tmp.r0lnnDTUn7/sql.sql: Permission denied
原因是 TMP_DIR="$(mktemp -d)" 这里创建的临时目录的权限是700, 然后把sql放进去后
再
因为postgres不能读取root创建的700临时目录, 就出现了 psql: error: /tmp/tmp.r0lnnDTUn7/sql.sql: Permission denied