Postgresql pg_升级期间postgres超级用户问题
我在Mac OSX上使用自制软件来管理postgres数据库。我正在尝试使用pg_升级将我的postgres安装从11.9升级到13.0。当我运行pg_升级时,我得到以下关于不是超级用户的错误。如果我尝试以“postgres”用户的身份运行,我会得到一个错误,即“postgres”用户不是安装用户Postgresql pg_升级期间postgres超级用户问题,postgresql,homebrew,pg-upgrade,Postgresql,Homebrew,Pg Upgrade,我在Mac OSX上使用自制软件来管理postgres数据库。我正在尝试使用pg_升级将我的postgres安装从11.9升级到13.0。当我运行pg_升级时,我得到以下关于不是超级用户的错误。如果我尝试以“postgres”用户的身份运行,我会得到一个错误,即“postgres”用户不是安装用户 pg_upgrade --old-datadir /usr/local/var/postgresql@11 --new-datadir /usr/local/var/postgres --old-bi
pg_upgrade --old-datadir /usr/local/var/postgresql@11 --new-datadir /usr/local/var/postgres --old-bindir /usr/local/Cellar/postgresql@11/11.9/bin --new-bindir /usr/local/Cellar/postgresql/13.0/bin -c -U Brian
Performing Consistency Checks
-----------------------------
Checking cluster versions ok
connection to database failed: FATAL: must be superuser to connect in binary upgrade mode
could not connect to source postmaster started with the command:
"/usr/local/Cellar/postgresql@11/11.9/bin/pg_ctl" -w -l "pg_upgrade_server.log" -D "/usr/local/var/postgresql@11" -o "-p 50432 -b -c listen_addresses='' -c unix_socket_permissions=0700 -c unix_socket_directories='/usr/local/Cellar'" start
Failure, exiting
尝试成为“postgres”用户
我的系统用户名是“Brian”,最初的11.9数据库是作为该用户安装的,但不知何故它没有超级用户权限。我不知道这是怎么发生的,但直到现在才完全意识到。我的13.0数据库似乎正确设置为“Brian”超级用户
template1=# \du+
List of roles
Role name | Attributes | Member of | Description
---------------+-------------------------------------+------------+-------------
Brian | Create role, Create DB, Replication | {} |
当我使用psql-d template1-U postgres
登录并尝试更改角色时,我得到以下错误
template1=# alter role Brian with superuser;
ERROR: role "brian" does not exist
Time: 0.415 ms
如果我以sudo-u postgres-I
的身份登录并尝试更改或创建用户,我还会收到以下错误:
psql -c "alter role Brian with superuser;"
ERROR: role "brian" does not exist
createuser -s Brian
createuser: error: creation of new role failed: ERROR: role "Brian" already exists
有谁知道为什么postgres会对“Brian”和“Brian”感到困惑,以及我如何赋予超级用户“Brian”角色的权限,以便我能够正确执行PGU升级?当我尝试
brew postgresql升级数据库时
最初给了我相同的超级用户错误,现在重新运行时,它表示所有内容都已升级。SQL中的SQL标识符的大小写将被忽略,双引号中的情况除外:
alter role "Brian" with superuser;
但是当在命令行上指定时(例如使用-U),大小写不会被忽略。Ha。那怎么样。我已经使用postgres很多年了,从来都不知道这个小事实。一直以来。。。谢谢成功了!
alter role "Brian" with superuser;