Mac上使用homebrew安装PostgreSql 相关总结
2016-11-01 18:49
330 查看
1. brew安装命令brew install postgresql2. 查看安装的版本pg_ctl -V3. 安装成功之后,安装路径为:/usr/local/var/postgres4. 初始化数据库:initdb /usr/local/var/postgres5. 配置开机登陆(可选):
7.查看进程:
$ mkdir -p ~/Library/LaunchAgents $ cp /usr/local/Cellar/postgresql/9.3.5_1/homebrew.mxcl.postgresql.plist ~/Library/LaunchAgents/ $ launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist手动启动 postgresql
$ pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start查看状态:
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log status停止:
$ pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log stop -s -m fast6.连接数据库
$ ps auxwww | grep postgres june 56126 0.0 0.0 2432772 644 s000 S+ 5:01下午 0:00.00 grep postgres june 56058 0.0 0.0 2467360 584 ?? Ss 5:00下午 0:00.00 postgres: stats collector process june 56057 0.0 0.0 2611808 1744 ?? Ss 5:00下午 0:00.00 postgres: autovacuum launcher process june 56056 0.0 0.0 2611676 696 ?? Ss 5:00下午 0:00.00 postgres: wal writer process june 56055 0.0 0.0 2611676 944 ?? Ss 5:00下午 0:00.01 postgres: writer process june 56054 0.0 0.0 2611676 756 ?? Ss 5:00下午 0:00.00 postgres: checkpointer process june 56044 0.0 0.2 2611676 14096 s000 S 5:00下午 0:00.02 /usr/local/Cellar/postgresql/9.3.5_1/bin/postgres -D /usr/local/var/postgres8.卸载
$ brew uninstall postgres如果配置了开机登陆:
$ launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist $ rm -rf ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist9.进入命令行模式:
$ psql -U test test_db -h localhost -W如果出现
FATAL: Ident authentication failed for user,是因为:This is because by default PostgreSQL uses ‘ident’ authentication i.e it checks if the username exists on the system. You need to change authentication mode to ‘trust’ as we do not want to add a system user. Modify the settings in “pg_hba.conf” to use ‘trust’authentication.请修改 /usr/local/var/postgres/pg_hba.conf 为:
host all all 127.0.0.1/32 trust # IPv6 local connections: host all all ::1/128 trust安装 pgadmin,下载地址:http://www.pgadmin.org/download/macosx.php
相关文章推荐
- Mac上的包管理器Homebrew的介绍及安装和使用实践
- Mac 下 PostgreSQL 的安装与使用
- Mac 下 PostgreSQL 的安装与使用
- Mac下 PostgreSQL 的安装与使用
- Mac OS X上安装和使用Homebrew和Homebrew Cask来进行软件安装管理
- Mac OS X 程序员利器 – Homebrew安装与使用
- Mac安装和使用HomeBrew
- Mac 下 PostgreSQL 的安装与使用
- Mac 下 PostgreSQL 的安装与使用
- Mac下使用Homebrew 安装MySQL
- Mac OS X 程序员利器 – Homebrew安装与使用
- Mac下PostgreSQL的安装与使用
- Mac下使用homebrew安装老版本的工具方法
- Mac下的Homebrew安装与使用
- Mac上的包管理器Homebrew的介绍及安装和使用实践
- Mac系统下Homebrew的安装和使用Homebrew安装python
- Mac OS X 下 HomeBrew的安装和简单使用
- 环境安装系列 - Mac的使用总结
- PostgreSQL 安装,使用总结
- Mac 下使用 Homebrew 安装 Nginx