FreeBSD下安装PostgreSQL新手教程

http://tech.ddvip.com   2007年10月26日    社区交流

内容摘要:今天我们就来说说PostgreSQL在FreeBSD平台上的安装过程,没有什么复杂的,只是我这两天安装过程的一个总结,希望能够安装的新手一个提示。( 我们使用的FreeBSD系统是5.2.1版,其他安装平台应该类似,我们以下安装PostgreSQL全部手工,你也可以使用ports)

  $ LOG: could not create socket for statistics collector: Protocol not supported

  LOG: database system was shut down at 2004-09-17 14:20:52 CST

  LOG: checkpoint record is at 0/9B6E1C

  LOG: redo record is at 0/9B6E1C; undo record is at 0/0; shutdown TRUE

  LOG: next transaction ID: 541; next OID: 17143

  LOG: database system is ready

  这时候程序就停在这里了,因为程序已经启动了,不能结束当前的程序,否则数据库会终止运行,这时候我们再另开一个终端以postgres用户

  登陆后查看进程:

  $ top

  PID USERNAME PRI NICE  SIZE  RES STATE  TIME  WCPU  CPU COMMAND

  891 postgres 96  0 13508K 2708K select  0:00 0.00% 0.00% postgres

  如果看到上面类似的进程,那么我们的PostgreSQL就启动成功,能够使用了。

  最后再建立一个数据库:

  $ /usr/local/pgsql/bin/createdb test      # 建立一个数据库test

  CREATE DATABASE

  创建数据库成功后,就能够通过PostgreSQL的客户端连接过去:

  $ /usr/local/pgsql/bin/psql test

  Welcome to psql 7.4.5, the PostgreSQL interactive terminal.

  Type: /copyright for distribution terms

   /h for help with SQL commands

   /? for help on internal slash commands

   /g or terminate with semicolon to execute query

   /q to quit

  test=#

  最后的,test=#是终端提示符,那么你就能够这里管理PostgreSQL和执行SQL语句,具体请参考PostgreSQL手册。

责编:豆豆技术应用

正在加载评论...