我正在设置PostgreSQL 9.1。我不能用PostgreSQL做任何事情:不能createdb,不能createuser;所有操作都返回错误消息
Fatal: role h9uest does not exist
h9uest是我的帐户名,我在这个帐户下执行apt-get安装PostgreSQL 9.1。 根帐户仍然存在类似的错误。
我正在设置PostgreSQL 9.1。我不能用PostgreSQL做任何事情:不能createdb,不能createuser;所有操作都返回错误消息
Fatal: role h9uest does not exist
h9uest是我的帐户名,我在这个帐户下执行apt-get安装PostgreSQL 9.1。 根帐户仍然存在类似的错误。
当前回答
使用——no-owner——no-privileges标记转储和恢复
e.g.
Dump - pg_dump——no-owner——no-privileges——format=c——dbname=postgres://userpass:username@postgres:5432/schemaname > /tmp/full.dump
恢复- pg_restore——no-owner——no-privileges——format=c——dbname=postgres://userpass:username@postgres:5432/schemaname /tmp/full.dump
其他回答
工作方法,
vi /etc/postgresql/9.3/main/pg_hba.conf 本地所有postgres peer 这里将peer改为trust 重启,sudo服务postgresql重启 现在试试,psql -U postgres
我把它安装在macOS上,必须:
cd /Applications/Postgres.app/Contents/Versions/9.5/bin
createuser -U postgres -s YOURUSERNAME
createdb YOURUSERNAME
来源如下:https://github.com/PostgresApp/PostgresApp/issues/313#issuecomment-192461641
对我来说,像将端口从5432更改为5433这样简单的操作就可以了。
遵循以下步骤,它将为你工作:
run msfconsole type db_console some information will be shown to you chose the information who tell you to make: db_connect user:pass@host:port.../database sorry I don't remember it but it's like this one then replace the user and the password and the host and the database with the information included in the database.yml in the emplacement: /usr/share/metasploit-framework/config you will see. rebuilding the model cache in the background. Type apt-get update && apt-get upgrade after the update restart the terminal and lunch msfconsole and it works you can check that by typing in msfconsole: msf>db_status you will see that it's connected.
sudo -u postgres createuser --superuser $USER
sudo -u postgres createdb $USER
这绝对适合你。