【Mac】当我使用Homebrew修改postgresql版本后,它无法正常运行

发生的事情

在安装了新版本之后,尝试启动旧版本时,出现了错误256的状态,导致无法正常运行。

$ brew install postgresql@14

$ brew services list
Name           Status  User  Plist
postgresql@14  stopped      
postgresql@11  error  256

卸载后,令人感到奇怪的现象是它继续存在。

$ brew uninstall postgresql@14

$ brew list | grep postgresql
postgresql
postgresql@14

?请参考以下链接了解版本切换和启动方法!

 

查找过的事情 guò de

看起来,初次安装的版本和新版本之间,数据库的位置似乎发生了变化。

# 旧
/usr/local/var/postgres

# 新
/usr/local/Cellar/postgresql

我参考了这个。

 

曾经做过的事情

通过删除旧的文件并重新安装,错误消失了。

$ rm -rf /usr/local/var/postgres*

$ brew reinstall postgresql@11
$ brew reinstall postgresql@14

$ brew services start postgresql@11

$ brew services list
Name           Status  User  Plist     
postgresql@11  started yuppy ~/Library/LaunchAgents/homebrew.mxcl.postgresql@11.plist
postgresql@14  none
广告
将在 10 秒后关闭
bannerAds