gitlab 使用postgresql数据库的一些说明
2015-08-21 14:30
441 查看
# cd /var/opt/gitlab/postgresql/data
# vim pg_hba.conf
host all all 192.168.1.0/24 trust 添加这行,192.168.1.0/24这个段的ip地址不需要密码可以连接
# vim postgresql.conf
listen_addresses = '192.168.1.125' 修改监听地址为ip
# gitlab-ctl restart postgresql
# cd /opt/gitlab/embedded/
# # bin/psql -U gitlab -d gitlabhq_production -h 192.168.1.125 不用输入密码就可进来
psql (9.2.10)
Type "help" for help.
gitlabhq_production=> alter user gitlab with password 'gitlab' 修改gitlab密码,gitlab创建的数据库超级用户为gitlab-psql,想修改密码自己通过命令修改即可
gitlabhq_production-> \q 退出
# cd /var/opt/gitlab/postgresql/data
host all all 192.168.1.0/24 md5 修改trust 为md5 ,即连接需要密码
# gitlab-ctl restart postgresql
# /opt/gitlab/embedded/bin/psql -U gitlab -d gitlabhq_production -h 192.168.1.125
Password for user gitlab: 输入密码gitlab 回车就可以进来了
既然修改了数据库gitlab用户的密码,gitlab服务器中数据库配置文件,也需要修改,不然数据库连接不上
# cd /var/opt/gitlab/
# vim gitlab-rails/etc/database.yml
production:
adapter: postgresql
encoding: unicode
database: gitlabhq_production
pool: 10
username: 'gitlab'
password: 'gitlab' 添加设置的密码
host: 192.168.1.125 更改为ip地址
port: 5432
# gitlab-ctl restart
ok了,可以去访问看看是否正常
做了上面的配置,我们可以使用Navicat Premium 连接postgresql,因为对postgresql不是很熟,图形管理方便点。
# vim pg_hba.conf
host all all 192.168.1.0/24 trust 添加这行,192.168.1.0/24这个段的ip地址不需要密码可以连接
# vim postgresql.conf
listen_addresses = '192.168.1.125' 修改监听地址为ip
# gitlab-ctl restart postgresql
# cd /opt/gitlab/embedded/
# # bin/psql -U gitlab -d gitlabhq_production -h 192.168.1.125 不用输入密码就可进来
psql (9.2.10)
Type "help" for help.
gitlabhq_production=> alter user gitlab with password 'gitlab' 修改gitlab密码,gitlab创建的数据库超级用户为gitlab-psql,想修改密码自己通过命令修改即可
gitlabhq_production-> \q 退出
# cd /var/opt/gitlab/postgresql/data
host all all 192.168.1.0/24 md5 修改trust 为md5 ,即连接需要密码
# gitlab-ctl restart postgresql
# /opt/gitlab/embedded/bin/psql -U gitlab -d gitlabhq_production -h 192.168.1.125
Password for user gitlab: 输入密码gitlab 回车就可以进来了
既然修改了数据库gitlab用户的密码,gitlab服务器中数据库配置文件,也需要修改,不然数据库连接不上
# cd /var/opt/gitlab/
# vim gitlab-rails/etc/database.yml
production:
adapter: postgresql
encoding: unicode
database: gitlabhq_production
pool: 10
username: 'gitlab'
password: 'gitlab' 添加设置的密码
host: 192.168.1.125 更改为ip地址
port: 5432
# gitlab-ctl restart
ok了,可以去访问看看是否正常
做了上面的配置,我们可以使用Navicat Premium 连接postgresql,因为对postgresql不是很熟,图形管理方便点。
相关文章推荐
- SQL Server排名或排序的函数
- 在EF4.1的DBContext中实现事务处理(BeginTransaction)和直接执行SQL语句的示例
- 安装Redis完整过程
- 关于Spring Data redis几种对象序列化的比较
- mysql语句在node.js中的写法
- ORA-01034: ORACLE not available
- MySQL不支持的特性
- mybatis半自动生成Bean和简单查询SQL
- oracle数据文件datafile找不到
- 在Mac os x 安装 Redis
- MongoDB 数据库下载和安装
- 客户端远程连接SQLServer2000数据库【图文教程】
- MySQL 远程连接配置和排
- Oracle中rownum和 order by联合使用导致排序错乱
- sqlserver2012 直接使用sql导入文件(csv等)
- Oracle的ERP系统中报表不好用?
- Mysql+DRBD+Keepalived集群架构配置
- Oracle的ERP系统中报表不好用?
- 在线并使用数据库来推断在线
- ubuntu 卸载/安装 redis