1
這是我的部署片段:使用bash部署PostgreSQL的 - 語法錯誤
APP="test"
DBPASS=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
sudo -u postgres -H createuser --no-createrole --no-superuser --no-createdb $APP_main
sudo -u postgres -H createdb -O $APP_main $APP_main
sudo -u postgres -H psql -c "alter user $APP_main with password '$DBPASS'"
這是我的日誌了:
/usr/lib/postgresql/9.1/bin/createdb: option requires an argument -- 'O'
Try "createdb --help" for more information.
ERROR: syntax error at or near "with password"
LINE 1: alter user with password 'hCGCly4ZVfu42Dr956ncypuf6mt0lBiY'
誰能解釋什麼錯誤?我已經指定了O參數,但它似乎並不接受它。
如果用戶已經存在,會發生什麼?我怎樣才能檢查這個? – Robert
@ Rob3這是一個純粹的數據庫問題。我會說你用另一個線索來問這個問題! – devnull