日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > linux >内容正文

linux

linux postgres用户,关于linux:在启动时创建postgres用户

發布時間:2025/6/15 linux 24 豆豆
生活随笔 收集整理的這篇文章主要介紹了 linux postgres用户,关于linux:在启动时创建postgres用户 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

我在啟動時從monit運行bash文件,bash文件啟動我的postgres服務器。

如果我的數據庫目錄不存在,我會:

1- initdb(postgresql / data /)

su - edge -c'/ usr / bin / initdb -D $ {DBDIR}'

2-復制修改后的pg_hba.conf和postgresql.conf文件到(postgresql / data /)

3-啟動我的服務器

su - edge -c"/ usr / bin / pg_ctl -w -D $ {DBDIR} -l logfile start"

4- postgres createuser

- su - $ User -c'$ {DBDIR} -e -s postgres'

執行bash文件后

postgresql / data /已創建

文件被復制

服務器啟動,

但是沒有創建用戶,因此無法訪問我的數據庫

錯誤:/ usr / bin / psql -U postgres

psql:致命:角色"postgres"不存在

我無法破譯您的步驟#4,但postgres角色不存在的原因是因為步驟#1由用戶edge運行并且它不要求創建postgres 角色通過-U,因此它會以超級用戶身份創建egde角色。

每initdb文檔:

-U username

--username=username

Selects the user name of the database superuser. This defaults to the name of the effective user running initdb. It is really not

important what the superuser's name is, but one might choose to keep

the customary name postgres, even if the operating system user's name

is different.

要么initdb -U postgres,要么您更喜歡名為edge的超級用戶,請保持這樣,但要使用psql -U edge啟動psql,或將PGUSER環境變量設置為edge以避免每次都輸入。

謝謝,我已經閱讀了部分文檔,但無論出于何種原因,我讀到-U用于給出創建的超級用戶的名稱,而不是創建它。 應該只是因為在initdb之前無法創建超級用戶這一事實。

總結

以上是生活随笔為你收集整理的linux postgres用户,关于linux:在启动时创建postgres用户的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。