Mac OS安装PostgreSQL数据库
因项目需要,在本地的Mac上安装PostgreSQL,本文记录一下安装的整个步骤。这里采用EnterpriseDB 来下载安装,EnterpriseDB是全球唯一一家提供基于PostgreSQL企业级产品与服务的厂商。
首先,访问EnterpriseDB提供的下载地址:https://www.enterprisedb.com/downloads/postgres-postgresql-downloads。

在此,选择需要的版本,进行下载。下载完成之后,双击postgresql-****-osx.dmg 文件进行安装。

双击postgresql-11.3-2.osx进行安装,此时需要输入本机密码(开机密码)。

此后一路Next接口完成安装。其中包括:安装目录、扩展安装、数据库目录、用户密码、端口设置等,一般使用默认的就好。
安装完成之后,会在Mac的应用程序中出现如下程序:

此时执行其中的SQL Shell(psql)启动PostgreSQL。
$ /Library/PostgreSQL/11/scripts/runpsql.sh ;exit Server [localhost]: Database [postgres]: Port [5432]: Username [postgres]: Password for user postgres: psql (11.3) Type "help" for help. postgres=#
以Server为例,命令中默认为“Server [localhost]: ”,表示Server的默认配置值为中括号内的localhost。除了其中的Password需要输入密码,其他选项如无特殊需要,采用默认即可。
此时,再执行应用程序中图标为大象的pgAdmin 4,可启动管理postGreSQL的管理程序。

即可打开web管理界面。

在下图中输入密码,即可进入管理界面进行相应的操作。比如,可通过下图创建表等操作。

关注公众号:程序新视界,一个让你软实力、硬技术同步提升的平台
除非注明,否则均为程序新视界原创文章,转载必须以链接形式标明本文链接