首页 > 解决方案 > 创建新的 linux 用户时 Postgre 数据库致命错误

问题描述

于是我全新安装了kali linux,并以root用户登录,创建了一个名为gyrgam个人使用的用户。我输入的第一个命令是createuser gyrgam,它给了我这个输出

createuser: error: could not connect to database postgres: could not connect to server: No such file or directory
    Is the server running locally and accepting
    connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?

我在堆栈上搜索了此问题的解决方案,但我只设法找到如何使用systemctl start postgresql.service. 现在再次尝试createuser gyrgam后,它现在给了我这个错误:

createuser: error: could not connect to database postgres: FATAL:  role "root" does not exist

我什至确实重新安装了整个 linux,以解决这个问题。在重新安装之前,我当然遇到了同样的问题,我尝试了类似这里这里的解决方案,但它们要么对我不起作用,要么给了我其他错误。

我的目标是创建一个名为gyrgam. 但正如解释的那样,我得到了一些 postgres 数据库错误。

标签: linuxpostgresql

解决方案


看来您正在执行错误的命令。如果我理解正确,您想在 linux 中创建操作系统用户。虽然 createuser 命令应该在 postgres 数据库中创建用户。要在 linux 中创建操作系统用户,您应该使用 adduser 命令。请参阅此链接以供参考https://kali.training/topic/managing-users-and-groups/


推荐阅读