我跟着this tutorial打了一个拼写错误,我应该为我的django应用创建一个用户来连接;
我应该运行su - postgres -c "createuser www-data -P"
但是我跑了su - postgres -c "createuser www-dtata -P"
。
我不想继续,直到我删除该用户,我不知道该命令。我在搜索后找到并尝试DROP USER
,但终端返回了-su: DROP: command not found
。
答案 0 :(得分:3)
运行sudo su - postgres -c "dropuser www-dtata"
答案 1 :(得分:1)
您可以使用dropuser
控制台工具(请参阅https://www.postgresql.org/docs/current/static/app-dropuser.html):
su - postgres -c "dropuser www-dtata"
或使用DROP USER
SQL查询(请参阅https://www.postgresql.org/docs/current/static/sql-dropuser.html):
sudo -u postgres psql -c 'DROP USER "www-dtata";'
这两种方法做同样的事情。在SQL版本中,由于其中包含-
,您还需要在数据库用户名周围使用双引号。
答案 2 :(得分:-1)
sudo su
su-postgres -c“ dropuser www-dtata”