Postgresql-12
Postgres CREATE DATABASE 不工作
我正在
Mac
使用Monterey
. 當我第一次開始在這台機器上工作時,它的安裝Mac M1
有點問題。我搬到了似乎只是底層證券的前沿,所以我認為沒有太大變化。homebrew``postgres``GUI
postgres.app``postgres
無論如何,數據庫 (
Postgres 12
) 現在正在執行,我發現嘗試創建新數據庫時出現問題。第三方客戶端以及psql
.rich=# create database sresearch rich-# \l List of databases Name | Owner | Encoding | Collate | Ctype | Access privileges --------------+----------+----------+-------------+-------------+----------------------- postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | rich | rich | UTF8 | en_US.UTF-8 | en_US.UTF-8 | sresearch | rich | UTF8 | en_US.UTF-8 | en_US.UTF-8 | template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres + | | | | | postgres=CTc/postgres weather | rich | UTF8 | en_US.UTF-8 | en_US.UTF-8 | (5 rows) rich-# \c sresearch FATAL: no such database: sresearch
由於某種原因無法創建數據庫,即使它報告已經這樣做了。我不知道為什麼會這樣,但我想解決它。
我想我可以進行備份並嘗試通過刪除兩個版本來解決此問題,然後返回以
homebrew
重新開始Postgres 12
。我不確定如何找出這兩個略有不同的版本之間的區別,它們本質上是相同的。我怎樣才能解決這個問題?顯然我需要能夠製作新的數據庫。
更新:我剛剛重新安裝了
homebrew
版本並嘗試導入我的替代postgres.app
導出。它出於某種原因掛斷了,\connect <dbname>
但這很容易手動解決。在嘗試創建新數據庫時,此安裝**也給了我同樣的錯誤。**因此,即使從導出中,兩個版本都顯示相同。我不知道該嘗試什麼。
rich=# \c sres FATAL: no such database: sres # Indeed there is though Previous connection kept rich=#
更新:更多資訊 ==>
rich=# \l List of databases Name | Owner | Encoding | Collate | Ctype | Access privileges --------------+-------+----------+-------------+-------------+------------------- postgres | rich | UTF8 | C | C | rich | rich | UTF8 | C | C | sres | rich | UTF8 | C | C | sresearch | rich | UTF8 | en_US.UTF-8 | en_US.UTF-8 | template0 | rich | UTF8 | C | C | =c/rich + | | | | | rich=CTc/rich template1 | rich | UTF8 | C | C | =c/rich + | | | | | rich=CTc/rich (6 rows) rich=# \c sres; FATAL: no such database: sres Previous connection kept rich=# \s sresearch; Wrote history to file "sresearch". rich=#
以下是來自的回饋
Sequel
:更新。甚至更多。==>
rich=# CREATE DATABASE alpha; CREATE DATABASE rich=# \c alpha; FATAL: no such database: alpha Previous connection kept rich=# \l List of databases Name | Owner | Encoding | Collate | Ctype | Access privileges --------------+-------+----------+-------------+-------------+------------------- alpha | rich | UTF8 | C | C | postgres | rich | UTF8 | C | C | rich | rich | UTF8 | C | C | template0 | rich | UTF8 | C | C | =c/rich + | | | | | rich=CTc/rich template1 | rich | UTF8 | C | C | =c/rich + | | | | | rich=CTc/rich (5 rows) rich=# DROP DATABASE alpha; DROP DATABASE rich=# \l List of databases Name | Owner | Encoding | Collate | Ctype | Access privileges --------------+-------+----------+-------------+-------------+------------------- postgres | rich | UTF8 | C | C | rich | rich | UTF8 | C | C | template0 | rich | UTF8 | C | C | =c/rich + | | | | | rich=CTc/rich template1 | rich | UTF8 | C | C | =c/rich + | | | | | rich=CTc/rich (4 rows) rich=# CREATE DATABASE alpha; CREATE DATABASE rich=# \l List of databases Name | Owner | Encoding | Collate | Ctype | Access privileges --------------+-------+----------+-------------+-------------+------------------- alpha | rich | UTF8 | C | C | postgres | rich | UTF8 | C | C | rich | rich | UTF8 | C | C | template0 | rich | UTF8 | C | C | =c/rich + | | | | | rich=CTc/rich template1 | rich | UTF8 | C | C | =c/rich + | | | | | rich=CTc/rich (5 rows) rich=# \c alpha; FATAL: no such database: alpha Previous connection kept rich=#
罪魁禍首是
pgbouncer
文件.ini
,它需要每個列出的數據庫的單獨條目。創建數據庫沒問題,但是.ini
文件無法辨識新的數據庫名稱。