如何将PostgreSQL从9.4版升级到9.5版,而不会丢失数据?
发布时间:2020-12-13 16:55:25 所属栏目:百科 来源:网络整理
导读:我使用PostgreSQL数据库为我的Ruby on Rails应用程序(在Mac OS X 10.9)。 有什么详细的说明如何升级PostgreSQL数据库? 恐怕我会破坏数据库中的数据或弄乱它。 假设您已经使用home-brew安装和升级Postgres,您可以执行以下步骤。 停止当前Postgres服务器: l
我使用PostgreSQL数据库为我的Ruby on Rails应用程序(在Mac OS X 10.9)。
有什么详细的说明如何升级PostgreSQL数据库? 恐怕我会破坏数据库中的数据或弄乱它。
假设您已经使用home-brew安装和升级Postgres,您可以执行以下步骤。
>停止当前Postgres服务器: launchctl unload?/ Library / LaunchAgents / homebrew.mxcl.postgresql.plist initdb /usr/local/var/postgres9.5 -E utf8 pg_upgrade -v -d /usr/local/var/postgres -D /usr/local/var/postgres9.5 -b /usr/local/Cellar/postgresql/9.4.5_2/bin/ -B /usr/local/Cellar/postgresql/9.5.0/bin/ >将新数据移动到位: cd /usr/local/var mv postgres postgres9.4 mv postgres9.5 postgres >重新启动Postgres: launchctl load?/ Library / LaunchAgents / homebrew.mxcl.postgresql.plist gem uninstall pg gem install pg 我建议你花一些时间阅读PostgreSQL documentation,以确切地了解你在上述步骤中做什么,以减少沮丧。 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |