How to upgrade PostgreSQL from version 9.6 to version 10.1 without losing data?

后端 未结 15 2681
挽巷
挽巷 2020-12-02 03:33

I\'m using the PostgreSQL database for my Ruby on Rails application (on Mac OS X 10.9).

Are there any detailed instructions on how to upgrade PostgreSQL database?

15条回答
  •  旧巷少年郎
    2020-12-02 03:56

    Despite all answers above, here goes my 5 cents.

    It works on any OS and from any-to-any postgres version.

    • Stop any running postgres instance;
    • Install the new version and start it; Check if you can connect to the new version as well;
    • Change old version's postgresql.conf -> port from 5432 to 5433;
    • Start the old version postgres instance;
    • Open a terminal and cd to the new version bin folder;
    • Run pg_dumpall -p 5433 -U | psql -p 5432 -U
    • Stop old postgres running instance;

提交回复
热议问题