PostgreSQL安装
#下载 访问https://www.postgresql.org/download/,点击左侧的‘source'进行下载,一般选择bz2的安装包。
#安装相关软件包 yum install -y zlib-devel yum install -y readline-devel
#安装PostgreSQL tar -xvf postgresql-9.5.6.tar.bz2 cd postgresql-9.5.6 ./configure --prefix=/usr/local/pgsql9.5.6--enable-thread-safety --with-perl --with-python make make install ln -s /usr/local/pgsql9.5.6 /usr/local/pgsql
#安装contrib下的工具 cd postgresql-9.5.6/contrib make make install
export PATH=$PATH:/usr/local/pgsql/bin export LD_LIBRARY_PATH=/usr/local/pgsql/lib #让以上设置对所有用户生效 vi /etc/profile 在最后添加: export PATH=$PATH:/usr/local/pgsql/bin exportLD_LIBRARY_PATH=/usr/local/pgsql/lib:$LD_LIBRARY_PATH
cd /data/server mkdir pgdata export PGDATA=/data/server/pgdata
[root@pc2 server]# initdb initdb: cannot be run as root Please log in (using,e.g.,"su")as the (unprivileged) user that will own the server process.
#新建普通用户,初始化数据库 useradd postgres cd /data/server chown -R postgres:postgres pgdata su - postgres export PGDATA=/data/server/pgdata initdb
#启动数据库 pg_ctl -D /data/server/pgdata start
#登录数据库测试 [postgres@pc2 ~]$ psql psql (9.5.6) Type "help" for help. postgres-# l List ofdatabases Name | Owner| Encoding | Collate |Ctype | Access privileges -----------+----------+----------+-------------+-------------+----------------------- postgres| postgres | UTF8 |en_US.UTF-8 | en_US.UTF-8 | template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 |=c/postgres + | || | | postgres=CTc/postgres template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 |=c/postgres + | | | | | postgres=CTc/postgres (3 rows)
--本篇文章参考自《PostgreSQL 修炼之道:从小工到专家》 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- c# – 向应用程序发送击键,SendKeys.Send()vs SendMessage(
- Swift专题讲解十五——类型构造
- ruby-on-rails – 如何使用belongs_to对象编写范围?
- 为什么C将此视为模糊函数引用
- 第二部分:如何使Ruby AES-256-CBC和PHP MCRYPT_RIJNDAEL_1
- c# – 从JSON字符串中获取动态键的值
- c# – 为什么“索引超出范围”异常列表但不是数组?
- 使用Cocos2d-x-3.6创建Lua项目Cocos Code IDE V1.2可调试
- ruby-on-rails-3 – 为什么“捆绑更新”不更新Gemfile以使用
- ruby – Rspec 3 vs Rspec 2匹配器