[英]How can I execute the creation of user for psql using a bash?
我正在嘗試這樣做:
sudo -H -u postgres bash -c 'psql -c "CREATE USER admin WITH PASSWORD "qwerty";"'
我把它放在一個文件中並執行,但它不起作用......
我想這是因為引號和雙引號......
如何使用 bash 文件為 psql 創建用戶?
非常感謝 !
SQL 中的字符串需要單引號。 您可以使用
sudo -H -u postgres psql -c "CREATE USER admin WITH PASSWORD 'qwerty'"
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.