[英]How can I execute the creation of user for psql using a bash?
I am trying to do that:我正在尝试这样做:
sudo -H -u postgres bash -c 'psql -c "CREATE USER admin WITH PASSWORD "qwerty";"'
I put that in a file and execute but it does not work...我把它放在一个文件中并执行,但它不起作用......
I suppose it is because of quote and double quotes...我想这是因为引号和双引号......
How can I do to create a user for psql using a bash file?如何使用 bash 文件为 psql 创建用户?
Thank you very much !非常感谢 !
Strings in SQL require single quotes. SQL 中的字符串需要单引号。 You can use
您可以使用
sudo -H -u postgres psql -c "CREATE USER admin WITH PASSWORD 'qwerty'"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.