简体   繁体   English

在IntelliJ IDEA中首次设置Postgres

[英]Setting Up Postgres for the first time in IntelliJ IDEA

Ok so I am currently trying to set up a Postgres Database on IntelliJ and I'm running into an issue. 好的,所以我目前正在尝试在IntelliJ上设置Postgres数据库,但遇到了问题。 I was going through the settings trying to understand the different configurations and get a better understanding of what was going on as I've never dealt with any kind of SQL related databases before. 我正在经历设置,试图了解不同的配置,并更好地了解正在发生的事情,因为我以前从未处理过任何与SQL相关的数据库。 Not to my knowledge at least. 至少据我所知。 When I click on the schema tab, this prompt shows up: 当我单击架构选项卡时,将显示以下提示:

The specified user/password combination is rejected: [08004] The server requested password-based authentication, but no password was provided.

This is followed by a prompt asking for a username & password. 然后提示输入用户名和密码。 I entered root (literally) in the username section, and a made up password in the password section, and I got this error message: 我进入root的名节(直译),以及包括了password在密码部分,我得到这个错误信息:

The specified user/password combination is rejected: [28P01] FATAL: password authentication failed for user "root" . The specified user/password combination is rejected: [28P01] FATAL: password authentication failed for user "root"

I am not sure what I am supposed to do as I was never asked to set up a password. 我不确定应该怎么做,因为从来没有要求我设置密码。 From what I get from the prompt, a username seems to have already been defined by IntelliJ. 根据我从提示中得到的信息,IntelliJ似乎已经定义了用户名。 How do I find out what that username is and reset the password ? 我如何找出该username是什么并重置password And if that's not the way to go, how should I go about solving this issue? 如果那不是要走的路,那我该如何解决这个问题呢?

EDIT: I finally figured it out. 编辑:我终于想通了。 The username had to be the same as the name of my database. 用户名必须与我的数据库名称相同。 From then I was able to set up my password, and everything worked fine. 从那时起,我便能够设置密码,并且一切正常。

What did you do while the installation of pg ? 在安装pg时您做了什么? I remember that default values are root:root for login credentials Did you try to connect yourself on your db using pg as command line ? 我记得默认值是root:root用于登录凭据。是否尝试使用pg作为命令行将自己连接到数据库?

Change in the PostgreSQL config file pg_hba.conf parameter for authentication method for IPv4 local connections to 'trust' instead 'md5' or 'peer': 将用于IPv4本地连接的身份验证方法的PostgreSQL配置文件pg_hba.conf参数更改为“信任”,而不是“ md5”或“对等”:

IPv4 local connections: IPv4本地连接:

host all all 127.0.0.1/32 trust 托管所有所有127.0.0.1/32信任

And then, you have to restart your postgresql-server with command - 'sudo service postgresql restart' - it helped for me with the same issue. 然后,您必须使用命令-'sudo service postgresql restart'重新启动您的postgresql服务器-这对我也有帮助。 Sorry for the bad markup, because I'm new here on stackoverflow. 很抱歉标记错误,因为我是stackoverflow的新手。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM