Git Product home page Git Product logo

Comments (7)

ningyile avatar ningyile commented on September 21, 2024

你好。对应的是PostgreSQL的数据用户名和密码。如有未尽事宜,请详细观看B站视频教程。

安装前请认真查看PostgreSQL和BDMCC的安装视频教程,请单击教程链接前往观看: https://www.bilibili.com/video/BV1Kc411q7g7/?vd_source=bf0edee2bc28836d99f5d19fd28d2225
教程前7分钟为通用部分,所有系统的用户都要观看,后面可根据自己系统在视频下方第一条评论单击时间戳跳转至相应的位置。

一键空降

from bdmcc_app.

tiansiyuan avatar tiansiyuan commented on September 21, 2024

你好。

B站上的视频看过了。

视频提到,在 macOS 上是不需要密码的。

但是在我的安装上,不输入密码是不行的。

我特意运行了 ALTER USER siyuant WITH PASSWORD 'Password';之后,输入这个密码也不行。

from bdmcc_app.

tiansiyuan avatar tiansiyuan commented on September 21, 2024

"数据库名称"是不是误导了?应该是"数据库用户名"?

from bdmcc_app.

ningyile avatar ningyile commented on September 21, 2024

你好。

B站上的视频看过了。

视频提到,在 macOS 上是不需要密码的。

但是在我的安装上,不输入密码是不行的。

我特意运行了 ALTER USER siyuant WITH PASSWORD 'Password';之后,输入这个密码也不行。

你好,macOS不需要密码的前提是你安装了Postgres.app这个应用,这个应用默认安装的HBA模式(对应的设置文件的路径为/Users/XXXXXX/Library/Application Support/Postgres/var-16/pg_hba.conf)是trust(如下图),所以此时不需要密码。但是如果你在你的macOS设备安装的是官方的或者源码编译的PostgreSQL,此时并不能保证你的模式是trust,很可能是MD5或者SHA256等加密模式,那么此时你就需要:

  1. 在BDMCC中设置你正确的用户名和密码(在终端中使用psql -U siyuanant命令确认该密码是否正确)。
    或者
  2. 将pg_hba.conf设置的method改为trust,然后再重启psql的service使最新设置生效,然后关闭并重新打开BDMCC软件即可。

hba

from bdmcc_app.

ningyile avatar ningyile commented on September 21, 2024

"数据库名称"是不是误导了?应该是"数据库用户名"?

确实是容易造成误解,V1.0.2会更新这个label。不过期初这里设计的初衷是提醒用户,你的PG数据库名称是否含有一个和数据库用户同名的数据库?PG在psql交互终端的逻辑是这样的,假如你只输入psql命令,那么psql终端会自动帮你传入你的用户名作为-U(用户名)和-d(数据库名)的参数,例如假如您的macOS设备的用户名是siyuanant,那么在输入psql命令的时候会自动传入两个参数至-U-d,即psql -U siyuanant -d siyuanant,假如你的PG数据库刚好有这个数据库用户siyuanant和对应模板数据库template生成的名为siyuanant的数据库,那么一切都会运行正常。但是假如两者缺乏一个,终端就会提示你,对应名为siyuanant的用户或者数据库不存在,那么此时你就没有办法用psql这个简短的命令了(这个命令可以使用的前提就是必须要有和macOS用户名相同的数据库用户和)。

同理,你在BDMCC软件上输入了你的用户名siyuanant,此时相当于传递两个参数,一个是-U,一个是给-d,只有两者都存在方可登录成功。如前面所说,你前面登录不成功的原因可能是这个(假如siyuanant的数据库用户名或者数据库名不存在,创建对应的即可)。所以我建议用户使用默认的postgres,因为在数据库默认安装的时候,无论是Windows、macOS还是Linux,所有的初始化结束后均会含有一个名为postgres的数据库用户和数据库,以提供是否登录成功的消息提示。因为写三个参数(用户名、数据库名、密码)怕用户懵,所以简写了两个。不过之后还是会按照你的建议改为数据库用户名。

查看已安装数据库名称最简单的方法就是在Postgres.app中查看,或者在psql交互终端中使用\l命令(是L的小写,代表list,并非1234的1)。

写的有点长,不知道你能不能绕得过来。如果你还是无法使用,微信联系我吧,我远程todesk帮你看看。

在Postgres.app中查看数据库名称含有系统用户名对应的值
db_list_2

在终端中查看数据库名称含有系统用户名对应的值
db_list_1

from bdmcc_app.

tiansiyuan avatar tiansiyuan commented on September 21, 2024

你好。
B站上的视频看过了。
视频提到,在 macOS 上是不需要密码的。
但是在我的安装上,不输入密码是不行的。
我特意运行了 ALTER USER siyuant WITH PASSWORD 'Password';之后,输入这个密码也不行。

你好,macOS不需要密码的前提是你安装了Postgres.app这个应用,这个应用默认安装的HBA模式(对应的设置文件的路径为/Users/XXXXXX/Library/Application Support/Postgres/var-16/pg_hba.conf)是trust(如下图),所以此时不需要密码。但是如果你在你的macOS设备安装的是官方的或者源码编译的PostgreSQL,此时并不能保证你的模式是trust,很可能是MD5或者SHA256等加密模式,那么此时你就需要:

  1. 在BDMCC中设置你正确的用户名和密码(在终端中使用psql -U siyuanant命令确认该密码是否正确)。
    或者
  2. 将pg_hba.conf设置的method改为trust,然后再重启psql的service使最新设置生效,然后关闭并重新打开BDMCC软件即可。

hba

我是用 brew 安装的 postgresql@16

我在 /usr/local/var/postgresql@16 目录下找到了 pg_hba.conf,里面的内容和你提到的一致:

# TYPE  DATABASE        USER            ADDRESS                 METHOD

# "local" is for Unix domain socket connections only
local   all             all                                     trust
# IPv4 local connections:
host    all             all             127.0.0.1/32            trust
# IPv6 local connections:
host    all             all             ::1/128                 trust
# Allow replication connections from localhost, by a user with the
# replication privilege.
local   replication     all                                     trust
host    replication     all             127.0.0.1/32            trust
host    replication     all             ::1/128                 trust

我安装 Postgres.app 试试。

from bdmcc_app.

tiansiyuan avatar tiansiyuan commented on September 21, 2024

安装 Postgres.app 后,可以了。

from bdmcc_app.

Related Issues (2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.