---
title: "用 homebrew 升級 postgres 資料庫"
description: "要升級 postgres，可以執行"
canonical: https://oozou.com/til/upgrade-postgres-database-with-homebrew-76
locale: zh-Hant
date: 2020-10-22
topic: shell
---

# 用 homebrew 升級 postgres 資料庫

> 要升級 postgres，可以執行

Published: 2020-10-22 · Topic: [shell](https://oozou.com/zh-Hant/til-topics/shell) ([markdown](https://oozou.com/zh-Hant/til-topics/shell.md))

要升級 postgres，可以執行

```shell
brew upgrade postgresql
```

升級完成之後，你現有資料庫裡的資料會和新的 postgres 執行檔不相容。通常你得使用 pg\_update 並傳入正確的執行檔來遷移資料，不過 brew 內建了一個升級腳本，可以幫你更新資料。

```shell
brew postgresql-upgrade-database
```

---

Contact OOZOU: hello@oozou.com · +66 2544 0000 · https://oozou.com/zh-Hant/contact

More for AI agents: https://oozou.com/llms.txt · every page has a markdown twin at its URL plus ".md"
